Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #37

Merged
merged 26 commits into from
Dec 17, 2024
Merged

Dev #37

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
78bec92
✨ feat(`QueryHelper.java`): Refactor query processing methods for imp…
vnobo Dec 16, 2024
7077002
✨ feat(`build.gradle`): Add support for multi-platform Docker images …
vnobo Dec 16, 2024
7fcb425
✨ feat(`build.gradle` and `.github/workflows/gradle-build.yml`): Upda…
vnobo Dec 16, 2024
0d65c85
✨ feat(`gradle-build.yml`): Update Docker image platform support to A…
vnobo Dec 16, 2024
205eccb
✨ feat(`build.gradle`): Update Gradle cache paths to use /tmp instead…
vnobo Dec 16, 2024
0ad4839
✨ fix(`gradle-build.yml`): Remove redundant image platform argument f…
vnobo Dec 16, 2024
9802936
✨ feat(`build.gradle`): Remove deprecated build cache configurations.
vnobo Dec 16, 2024
be1828c
✨ feat(`gradle-build.yml`): Add support for multi-platform builds in …
vnobo Dec 16, 2024
eee0fc7
✨ feat(`gradle-build.yml`): Expand multi-platform support in GitHub A…
vnobo Dec 16, 2024
f5e7043
✨ feat(`gradle-build.yml`): Enhance multi-platform support by dynamic…
vnobo Dec 16, 2024
b46a9c8
✨ feat(`gradle-build.yml`): Remove unsupported Linux ARMv6 and ARMv7 …
vnobo Dec 16, 2024
b6bbd1c
✨ fix(`gradle-build.yml`): Remove unnecessary matrix strategy and ima…
vnobo Dec 16, 2024
d651066
✨ feat(`gradle-build.yml`): Improve multi-platform support by adding …
vnobo Dec 16, 2024
baaba99
✨ feat(`gradle-build.yml`): Restore and update multi-platform matrix …
vnobo Dec 16, 2024
46780fd
✨ feat(`gradle-build.yml`): Update GitHub Actions workflow to set up …
vnobo Dec 16, 2024
c0ea338
✨ feat(`gradle-build.yml`): Enhance multi-platform support by adding …
vnobo Dec 16, 2024
a8feffb
✨ feat(`gradle-build.yml`): Update Docker build actions to explicitly…
vnobo Dec 16, 2024
0aff97b
✨ chore(`gradle-build.yml`): Simplify QEMU setup by removing explicit…
vnobo Dec 16, 2024
110aa35
✨ feat(`gradle-build.yml`): Refactor multi-platform support by consol…
vnobo Dec 16, 2024
d81bf30
✨ feat(`gradle-build.yml`): Update Docker registry and task name for …
vnobo Dec 16, 2024
8453e9f
Update gradle-build.yml
vnobo Dec 16, 2024
b72261e
更新 gradle-build.yml
vnobo Dec 16, 2024
07d42e0
✨ feat(`build.gradle`, `Dockerfile`, `gradle-build.yml`): Update Dock…
vnobo Dec 17, 2024
b44290b
✨ chore(`gradle-build.yml`): Modify `publishImage` flag for multi-pla…
vnobo Dec 17, 2024
c783fdd
✨ fix(`build.gradle`): Correct Docker image name format for local dep…
vnobo Dec 17, 2024
9af253e
✨ feat(`build.gradle`): Add buildWorkspace, buildCache, and launchCac…
vnobo Dec 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ on:
types: [ created ]
env:
GITHUB_REGISTRY: ghcr.io/${{ github.actor }}
DOCKER_REGISTRY: alexbob
DOCKER_REGISTRY: docker.io/alexbob
jobs:
boot-build-image:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
permissions:
contents: read
packages: write
Expand All @@ -25,6 +30,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up graalvm 21 for x64
uses: graalvm/setup-graalvm@v1
with:
Expand All @@ -33,10 +39,24 @@ jobs:
distribution: 'liberica'
native-image-job-reports: 'true'
cache: 'gradle'
- name: Execute Gradle platform bootBuildImage
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host

- name: Execute Gradle Plate bootBuildImage
run: |
chmod +x ./gradlew
./gradlew bootBuildImage
./gradlew bootBuildImage --imagePlatform=linux/amd64 --network=host --publishImage
./gradlew bootBuildImage --imagePlatform=linux/arm64 --network=host --publishImage
- name: Inspect
run: |
docker buildx imagetools inspect localhost:5000/plate-oauth2:latest
docker buildx imagetools inspect localhost:5000/plate-platform:latest

- name: Log into registry ${{ env.GITHUB_REGISTRY }}
if: github.event_name != 'pull_request'
Expand Down Expand Up @@ -70,6 +90,7 @@ jobs:
- name: Build and Push Platform
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: ./boot/platform
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
Expand All @@ -93,6 +114,7 @@ jobs:
- name: Build and Push Oauth2
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: ./boot/oauth2
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.oauth2.outputs.tags }}
Expand Down
2 changes: 1 addition & 1 deletion boot/oauth2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM plate-oauth2
FROM localhost:5000/plate-oauth2:latest

LABEL org.opencontainers.image.source=https://github.com/vnobo/plate
LABEL org.opencontainers.image.description="Plate oauth2 container image"
Expand Down
2 changes: 1 addition & 1 deletion boot/platform/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM plate-platform
FROM localhost:5000/plate-platform:latest

LABEL org.opencontainers.image.source=https://github.com/vnobo/plate
LABEL org.opencontainers.image.description="Plate platform container image"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public static QueryFragment query(Object object, Pageable pageable, String prefi
return query(object, pageable, List.of(), prefix);
}

@SuppressWarnings("unchecked")
public static QueryFragment query(Object object, Pageable pageable, Collection<String> skipKeys, String prefix) {
Map<String, Object> objectMap = BeanUtils.beanToMap(object, false, true);
Map<String, Object> filterMap = ObjectUtils.isEmpty(objectMap) ? Map.of() :
Expand All @@ -58,36 +57,42 @@ public static QueryFragment query(Object object, Pageable pageable, Collection<S
return queryFragment;
}

String queryKey = "query";
if (objectMap.containsKey(queryKey)) {
Map<String, Object> jsonMap = (Map<String, Object>) objectMap.get(queryKey);
QueryFragment jsonQueryFragment = QueryJsonHelper.queryJson(jsonMap, prefix);
processQueryKey(queryFragment, objectMap, prefix);
processSecurityCodeKey(queryFragment, objectMap, skipKeys, prefix);
processSearchKey(queryFragment, objectMap, prefix);

return queryFragment;
}

@SuppressWarnings("unchecked")
private static void processQueryKey(QueryFragment queryFragment, Map<String, Object> objectMap, String prefix) {
if (objectMap.containsKey("query")) {
var jsonMap = (Map<String, Object>) objectMap.get("query");
var jsonQueryFragment = QueryJsonHelper.queryJson(jsonMap, prefix);
queryFragment.mergeWhere(jsonQueryFragment.getWhereSql());
queryFragment.putAll(jsonQueryFragment);
}
}

String securityCodeKey = "securityCode";
if (!skipKeys.contains(securityCodeKey) && objectMap.containsKey(securityCodeKey)) {
String key = "tenant_code";
if (StringUtils.hasLength(prefix)) {
key = prefix + "." + key;
}
private static void processSecurityCodeKey(QueryFragment queryFragment, Map<String, Object> objectMap, Collection<String> skipKeys, String prefix) {
if (!skipKeys.contains("securityCode") && objectMap.containsKey("securityCode")) {
var key = StringUtils.hasLength(prefix) ? prefix + ".tenant_code" : "tenant_code";
queryFragment.addWhere(key + " LIKE :securityCode");
queryFragment.put("securityCode", objectMap.get(securityCodeKey));
queryFragment.put("securityTypeCode", objectMap.get("securityCode"));
}
}

String searchKey = "search";
if (objectMap.containsKey(searchKey) && !ObjectUtils.isEmpty(objectMap.get(searchKey))) {
String textSearch = (String) objectMap.get(searchKey);
queryFragment.addColumn("TS_RANK_CD(text_search, queryTextSearch) AS rank");
private static void processSearchKey(QueryFragment queryFragment, Map<String, Object> objectMap, String prefix) {
if (objectMap.containsKey("search") && !ObjectUtils.isEmpty(objectMap.get("search"))) {
var textSearch = (String) objectMap.get("search");
var column = StringUtils.hasLength(prefix) ? prefix + ".text_search" : "text_search";
queryFragment.addColumn("TS_RANK_CD(" + column + ", queryTextSearch) AS rank");
queryFragment.addQuery(",TO_TSQUERY('chinese',:textSearch) queryTextSearch");
queryFragment.addWhere("text_search @@ TO_TSQUERY('chinese',:textSearch)");
queryFragment.addWhere(column + " @@ TO_TSQUERY('chinese',:textSearch)");
queryFragment.put("textSearch", textSearch);
}
return queryFragment;
}


public static void applySort(QueryFragment queryFragment, Sort sort, String prefix) {
sort = QueryJsonHelper.transformSortForJson(sort);
for (Sort.Order order : sort) {
Expand All @@ -112,7 +117,7 @@ public static void applyWhere(QueryFragment queryFragment, String prefix) {
* If the object does not have a table annotation, it throws a QueryException.
*
* @param queryFragment The QueryFragment to which the query SQL will be applied.
* @param object The object containing the table annotation and data for the query.
* @param object The object containing the table annotation and data for the query.
* @throws QueryException If the object does not have a table annotation.
*/
public static void applyQuerySql(QueryFragment queryFragment, Object object) {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ configure(subprojects - project(":boot")) { project ->

tasks.named("bootBuildImage") {
createdDate = "now"
imageName = "${rootProject.name}-${project.name}"
imageName = "localhost:5000/${rootProject.name}-${project.name}:latest"
environment = [
"BPE_DELIM_JAVA_TOOL_OPTIONS" : " ",
"BPE_APPEND_JAVA_TOOL_OPTIONS": "-Dfile.encoding=UTF-8 " +
Expand Down
Loading