From 2dfff0f26a3379f5eef5e823f4a9651de7d33fe8 Mon Sep 17 00:00:00 2001
From: lorne <1991wangliang@gmail.com>
Date: Thu, 19 Mar 2026 17:52:29 +0800
Subject: [PATCH 1/2] fix fromItem.getAlias().getName() null point bug
---
.../example-app-cmd-domain/pom.xml | 2 +-
.../example-app/example-app-cmd-meta/pom.xml | 2 +-
example/example-app/example-app-query/pom.xml | 2 +-
example/example-app/pom.xml | 2 +-
.../example-domain-leave/pom.xml | 2 +-
.../example-domain-user/pom.xml | 2 +-
example/example-domain/pom.xml | 2 +-
.../example-infra/example-infra-flow/pom.xml | 2 +-
.../example-infra/example-infra-jpa/pom.xml | 2 +-
.../example-infra-security/pom.xml | 2 +-
example/example-infra/pom.xml | 2 +-
example/example-interface/pom.xml | 2 +-
example/example-server/pom.xml | 2 +-
example/pom.xml | 2 +-
pom.xml | 2 +-
springboot-starter-data-authorization/pom.xml | 2 +-
.../enhancer/TableColumnAliasHolder.java | 2 +-
.../analyzer/SelectSQLAnalyzerTest.java | 42 +++++++++++++++++++
springboot-starter-data-fast/pom.xml | 2 +-
springboot-starter-flow/pom.xml | 2 +-
springboot-starter-security/pom.xml | 2 +-
springboot-starter/pom.xml | 2 +-
22 files changed, 63 insertions(+), 21 deletions(-)
diff --git a/example/example-app/example-app-cmd-domain/pom.xml b/example/example-app/example-app-cmd-domain/pom.xml
index c919efca0..4020f607d 100644
--- a/example/example-app/example-app-cmd-domain/pom.xml
+++ b/example/example-app/example-app-cmd-domain/pom.xml
@@ -6,7 +6,7 @@
com.codingapi.springboot
example-app
- 3.4.34
+ 3.4.35
../pom.xml
diff --git a/example/example-app/example-app-cmd-meta/pom.xml b/example/example-app/example-app-cmd-meta/pom.xml
index 762fefc4b..b8a7e3d6a 100644
--- a/example/example-app/example-app-cmd-meta/pom.xml
+++ b/example/example-app/example-app-cmd-meta/pom.xml
@@ -6,7 +6,7 @@
com.codingapi.springboot
example-app
- 3.4.34
+ 3.4.35
../pom.xml
diff --git a/example/example-app/example-app-query/pom.xml b/example/example-app/example-app-query/pom.xml
index 02ed84bb2..e8fbfbc46 100644
--- a/example/example-app/example-app-query/pom.xml
+++ b/example/example-app/example-app-query/pom.xml
@@ -6,7 +6,7 @@
com.codingapi.springboot
example-app
- 3.4.34
+ 3.4.35
../pom.xml
diff --git a/example/example-app/pom.xml b/example/example-app/pom.xml
index 6004083b5..3049a6a28 100644
--- a/example/example-app/pom.xml
+++ b/example/example-app/pom.xml
@@ -6,7 +6,7 @@
com.codingapi.springboot
springboot-example
- 3.4.34
+ 3.4.35
../pom.xml
pom
diff --git a/example/example-domain/example-domain-leave/pom.xml b/example/example-domain/example-domain-leave/pom.xml
index b8a66289d..bc44444ac 100644
--- a/example/example-domain/example-domain-leave/pom.xml
+++ b/example/example-domain/example-domain-leave/pom.xml
@@ -6,7 +6,7 @@
com.codingapi.springboot
example-domain
- 3.4.34
+ 3.4.35
../pom.xml
diff --git a/example/example-domain/example-domain-user/pom.xml b/example/example-domain/example-domain-user/pom.xml
index 2270e50e7..a037bb495 100644
--- a/example/example-domain/example-domain-user/pom.xml
+++ b/example/example-domain/example-domain-user/pom.xml
@@ -6,7 +6,7 @@
com.codingapi.springboot
example-domain
- 3.4.34
+ 3.4.35
../pom.xml
diff --git a/example/example-domain/pom.xml b/example/example-domain/pom.xml
index f8c092f22..5501e25f1 100644
--- a/example/example-domain/pom.xml
+++ b/example/example-domain/pom.xml
@@ -5,7 +5,7 @@
com.codingapi.springboot
springboot-example
- 3.4.34
+ 3.4.35
../pom.xml
4.0.0
diff --git a/example/example-infra/example-infra-flow/pom.xml b/example/example-infra/example-infra-flow/pom.xml
index 930ecf282..21aec6360 100644
--- a/example/example-infra/example-infra-flow/pom.xml
+++ b/example/example-infra/example-infra-flow/pom.xml
@@ -5,7 +5,7 @@
com.codingapi.springboot
example-infra
- 3.4.34
+ 3.4.35
../pom.xml
diff --git a/example/example-infra/example-infra-jpa/pom.xml b/example/example-infra/example-infra-jpa/pom.xml
index 7d1cac30a..7806b63f0 100644
--- a/example/example-infra/example-infra-jpa/pom.xml
+++ b/example/example-infra/example-infra-jpa/pom.xml
@@ -5,7 +5,7 @@
com.codingapi.springboot
example-infra
- 3.4.34
+ 3.4.35
../pom.xml
diff --git a/example/example-infra/example-infra-security/pom.xml b/example/example-infra/example-infra-security/pom.xml
index 9bc41ec3b..ad5a7a461 100644
--- a/example/example-infra/example-infra-security/pom.xml
+++ b/example/example-infra/example-infra-security/pom.xml
@@ -6,7 +6,7 @@
com.codingapi.springboot
example-infra
- 3.4.34
+ 3.4.35
../pom.xml
diff --git a/example/example-infra/pom.xml b/example/example-infra/pom.xml
index 7689d4320..af47ca62f 100644
--- a/example/example-infra/pom.xml
+++ b/example/example-infra/pom.xml
@@ -6,7 +6,7 @@
com.codingapi.springboot
springboot-example
- 3.4.34
+ 3.4.35
../pom.xml
pom
diff --git a/example/example-interface/pom.xml b/example/example-interface/pom.xml
index 14189b74e..848df9f5d 100644
--- a/example/example-interface/pom.xml
+++ b/example/example-interface/pom.xml
@@ -6,7 +6,7 @@
com.codingapi.springboot
springboot-example
- 3.4.34
+ 3.4.35
example-interface
diff --git a/example/example-server/pom.xml b/example/example-server/pom.xml
index b55b8afb9..3ce4888c3 100644
--- a/example/example-server/pom.xml
+++ b/example/example-server/pom.xml
@@ -5,7 +5,7 @@
springboot-example
com.codingapi.springboot
- 3.4.34
+ 3.4.35
4.0.0
diff --git a/example/pom.xml b/example/pom.xml
index 0f6834b7f..2add9d2ed 100644
--- a/example/pom.xml
+++ b/example/pom.xml
@@ -19,7 +19,7 @@
springboot-example
- 3.4.34
+ 3.4.35
springboot-example
springboot-example project for Spring Boot
diff --git a/pom.xml b/pom.xml
index db7fb9596..789088e92 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,7 @@
com.codingapi.springboot
springboot-parent
- 3.4.34
+ 3.4.35
https://github.com/codingapi/springboot-framewrok
springboot-parent
diff --git a/springboot-starter-data-authorization/pom.xml b/springboot-starter-data-authorization/pom.xml
index 96cf14c57..0830a3e95 100644
--- a/springboot-starter-data-authorization/pom.xml
+++ b/springboot-starter-data-authorization/pom.xml
@@ -6,7 +6,7 @@
com.codingapi.springboot
springboot-parent
- 3.4.34
+ 3.4.35
springboot-starter-data-authorization
diff --git a/springboot-starter-data-authorization/src/main/java/com/codingapi/springboot/authorization/enhancer/TableColumnAliasHolder.java b/springboot-starter-data-authorization/src/main/java/com/codingapi/springboot/authorization/enhancer/TableColumnAliasHolder.java
index 726f3b9bc..eb33ff22d 100644
--- a/springboot-starter-data-authorization/src/main/java/com/codingapi/springboot/authorization/enhancer/TableColumnAliasHolder.java
+++ b/springboot-starter-data-authorization/src/main/java/com/codingapi/springboot/authorization/enhancer/TableColumnAliasHolder.java
@@ -64,7 +64,7 @@ private void searchSubSelect(String parent, PlainSelect plainSelect) {
if (fromItem instanceof Select) {
PlainSelect subPlainSelect = ((Select) fromItem).getPlainSelect();
this.appendColumnAlias(parent, null, plainSelect.getSelectItems());
- parent = fromItem.getAlias().getName();
+ parent = fromItem.getAlias()!=null?fromItem.getAlias().getName():null;
this.searchSubSelect(parent, subPlainSelect);
}
diff --git a/springboot-starter-data-authorization/src/test/java/com/codingapi/springboot/authorization/analyzer/SelectSQLAnalyzerTest.java b/springboot-starter-data-authorization/src/test/java/com/codingapi/springboot/authorization/analyzer/SelectSQLAnalyzerTest.java
index 1501e5ded..b73c8c85c 100644
--- a/springboot-starter-data-authorization/src/test/java/com/codingapi/springboot/authorization/analyzer/SelectSQLAnalyzerTest.java
+++ b/springboot-starter-data-authorization/src/test/java/com/codingapi/springboot/authorization/analyzer/SelectSQLAnalyzerTest.java
@@ -221,4 +221,46 @@ void test8() throws Exception{
assertEquals("SELECT ade1_0.id, ade1_0.ba_dept_name, ade1_0.ba_org_shortname, ade1_0.ba_dept_code, ade1_0.ba_code, ade1_0.ba_dept_property_code, ade1_0.ba_parent_type, ade1_0.ba_real_super_org_id, ade1_0.ba_org_is_avoidance_dept, ade1_0.ba_real_super_org_id, ade1_0.ba_super_org_name FROM ba04_administrative_department ade1_0 WHERE ade1_0.id < 100 AND ade1_0.ba_parent_type = 0 " +
"UNION ALL SELECT ade2_0.id, ade2_0.ba_dept_name, ade2_0.ba_org_shortname, ade2_0.ba_dept_code, ade2_0.ba_code, ade2_0.ba_dept_property_code, ade2_0.ba_parent_type, ade2_0.ba_real_super_org_id, ade2_0.ba_org_is_avoidance_dept, ade3_0.ba_real_super_org_id, ade3_0.ba_super_org_name FROM ba04_administrative_department ade2_0 LEFT JOIN ba04_administrative_department ade3_0 ON ade2_0.ba_real_super_org_id = ade3_0.id WHERE ade3_0.id < 100 AND ade2_0.id < 100 AND ade2_0.ba_real_super_org_id = 1", newSQL);
}
+
+
+ @Test
+ @Order(9)
+ void test9() throws Exception{
+ String sql = "select cd.id,cd.name,cd.parent_id from depart cd join depart pd on cd.id = pd.parent_id where cd.id = ?";
+
+ RowHandler rowHandler = (subSql, tableName, tableAlias) -> {
+ if (tableName.equalsIgnoreCase("depart") && tableAlias.equalsIgnoreCase("cd")) {
+ String conditionTemplate = "%s.id = 100 ";
+ return Condition.formatCondition(conditionTemplate, tableAlias);
+ }
+ return null;
+ };
+ DataPermissionSQLEnhancer builder = new DataPermissionSQLEnhancer(sql, rowHandler);
+ String newSQL = builder.getNewSQL();
+ System.out.println(newSQL);
+ System.out.println(builder.getTableAlias().getTableAlias());
+ assertEquals("SELECT cd.id, cd.name, cd.parent_id FROM depart cd JOIN depart pd ON cd.id = pd.parent_id WHERE cd.id = 100 AND cd.id = ?",newSQL);
+ }
+
+
+
+ @Test
+ @Order(10)
+ void test10() throws Exception{
+ String sql = "SELECT * FROM ( SELECT TMP.*, ROWNUM ROW_ID FROM ( SELECT t.id,t.parent_id,t.type,t.target_id,t.system_code,t.full_name,t.short_name,t.system_short_name,t.full_name_tair,t.short_name_tair,t.system_short_name_tair,t.tree_sort,t.sys_creator_id,t.sys_updater_id,t.sys_create_time,t.sys_update_time,t.sys_deleted,t.sys_enabled,parent.short_name AS parentName,parent.type AS parentType,if(parent.type=0,'单位','部门') AS parentTypeText FROM sys_u_organization t LEFT JOIN sys_u_organization parent ON (parent.id = t.parent_id AND parent.sys_deleted=0) LEFT JOIN sys_u_company t2 ON (t2.organization_id = t.id AND t2.sys_deleted=0) WHERE t.sys_deleted=0 AND (t.id <> ? AND t.type = ? AND t.system_code LIKE ?) ORDER BY t.tree_sort ASC,t.tree_sort ASC ) TMP WHERE ROWNUM <=?) WHERE ROW_ID > ?";
+
+ RowHandler rowHandler = (subSql, tableName, tableAlias) -> {
+ if (tableName.equalsIgnoreCase("sys_u_organization")) {
+ String conditionTemplate = "%s.id < 100 ";
+ return Condition.formatCondition(conditionTemplate, tableAlias);
+ }
+ return null;
+ };
+ DataPermissionSQLEnhancer builder = new DataPermissionSQLEnhancer(sql, rowHandler);
+ String newSQL = builder.getNewSQL();
+ System.out.println(newSQL);
+ System.out.println(builder.getTableAlias().getTableAlias());
+ assertEquals("SELECT * FROM (SELECT TMP.*, ROWNUM ROW_ID FROM (SELECT t.id, t.parent_id, t.type, t.target_id, t.system_code, t.full_name, t.short_name, t.system_short_name, t.full_name_tair, t.short_name_tair, t.system_short_name_tair, t.tree_sort, t.sys_creator_id, t.sys_updater_id, t.sys_create_time, t.sys_update_time, t.sys_deleted, t.sys_enabled, parent.short_name AS parentName, parent.type AS parentType, if(parent.type = 0, '单位', '部门') AS parentTypeText FROM sys_u_organization t LEFT JOIN sys_u_organization parent ON (parent.id = t.parent_id AND parent.sys_deleted = 0) LEFT JOIN sys_u_company t2 ON (t2.organization_id = t.id AND t2.sys_deleted = 0) WHERE parent.id < 100 AND t.id < 100 AND t.sys_deleted = 0 AND (t.id <> ? AND t.type = ? AND t.system_code LIKE ?) ORDER BY t.tree_sort ASC, t.tree_sort ASC) TMP WHERE ROWNUM <= ?) WHERE ROW_ID > ?", newSQL);
+ }
+
}
diff --git a/springboot-starter-data-fast/pom.xml b/springboot-starter-data-fast/pom.xml
index f09953716..841d1cde8 100644
--- a/springboot-starter-data-fast/pom.xml
+++ b/springboot-starter-data-fast/pom.xml
@@ -5,7 +5,7 @@
springboot-parent
com.codingapi.springboot
- 3.4.34
+ 3.4.35
4.0.0
diff --git a/springboot-starter-flow/pom.xml b/springboot-starter-flow/pom.xml
index 8328b0eb9..9e452ee04 100644
--- a/springboot-starter-flow/pom.xml
+++ b/springboot-starter-flow/pom.xml
@@ -6,7 +6,7 @@
springboot-parent
com.codingapi.springboot
- 3.4.34
+ 3.4.35
springboot-starter-flow
diff --git a/springboot-starter-security/pom.xml b/springboot-starter-security/pom.xml
index 7200b4b4b..441fd4677 100644
--- a/springboot-starter-security/pom.xml
+++ b/springboot-starter-security/pom.xml
@@ -6,7 +6,7 @@
springboot-parent
com.codingapi.springboot
- 3.4.34
+ 3.4.35
springboot-starter-security
diff --git a/springboot-starter/pom.xml b/springboot-starter/pom.xml
index c36f0e1aa..a33daf78f 100644
--- a/springboot-starter/pom.xml
+++ b/springboot-starter/pom.xml
@@ -5,7 +5,7 @@
com.codingapi.springboot
springboot-parent
- 3.4.34
+ 3.4.35
springboot-starter
From b1eb58c08ba62fa04577564686cb89bcba49ee9e Mon Sep 17 00:00:00 2001
From: lorne <1991wangliang@gmail.com>
Date: Thu, 19 Mar 2026 17:53:54 +0800
Subject: [PATCH 2/2] fix fromItem.getAlias().getName() null point bug
---
.../authorization/enhancer/TableColumnAliasHolder.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/springboot-starter-data-authorization/src/main/java/com/codingapi/springboot/authorization/enhancer/TableColumnAliasHolder.java b/springboot-starter-data-authorization/src/main/java/com/codingapi/springboot/authorization/enhancer/TableColumnAliasHolder.java
index eb33ff22d..d3aaeab72 100644
--- a/springboot-starter-data-authorization/src/main/java/com/codingapi/springboot/authorization/enhancer/TableColumnAliasHolder.java
+++ b/springboot-starter-data-authorization/src/main/java/com/codingapi/springboot/authorization/enhancer/TableColumnAliasHolder.java
@@ -75,7 +75,7 @@ private void searchSubSelect(String parent, PlainSelect plainSelect) {
FromItem currentItem = join.getRightItem();
PlainSelect subPlainSelect = ((Select) currentItem).getPlainSelect();
this.appendColumnAlias(parent, null, plainSelect.getSelectItems());
- parent = currentItem.getAlias().getName();
+ parent = currentItem.getAlias()!=null?currentItem.getAlias().getName():null;
this.searchSubSelect(parent, subPlainSelect);
}
if (join.getRightItem() instanceof Table) {