Skip to content
Merged

Dev #188

Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion example/example-app/example-app-cmd-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-app</artifactId>
<version>3.4.34</version>
<version>3.4.35</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-app/example-app-cmd-meta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-app</artifactId>
<version>3.4.34</version>
<version>3.4.35</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-app/example-app-query/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-app</artifactId>
<version>3.4.34</version>
<version>3.4.35</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.4.34</version>
<version>3.4.35</version>
<relativePath>../pom.xml</relativePath>
</parent>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion example/example-domain/example-domain-leave/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-domain</artifactId>
<version>3.4.34</version>
<version>3.4.35</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-domain/example-domain-user/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-domain</artifactId>
<version>3.4.34</version>
<version>3.4.35</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.4.34</version>
<version>3.4.35</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/example-infra-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-infra</artifactId>
<version>3.4.34</version>
<version>3.4.35</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/example-infra-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-infra</artifactId>
<version>3.4.34</version>
<version>3.4.35</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/example-infra-security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-infra</artifactId>
<version>3.4.34</version>
<version>3.4.35</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.4.34</version>
<version>3.4.35</version>
<relativePath>../pom.xml</relativePath>
</parent>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion example/example-interface/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.4.34</version>
<version>3.4.35</version>
</parent>

<artifactId>example-interface</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion example/example-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>springboot-example</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.4.34</version>
<version>3.4.35</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</parent>

<artifactId>springboot-example</artifactId>
<version>3.4.34</version>
<version>3.4.35</version>

<name>springboot-example</name>
<description>springboot-example project for Spring Boot</description>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-parent</artifactId>
<version>3.4.34</version>
<version>3.4.35</version>

<url>https://github.com/codingapi/springboot-framewrok</url>
<name>springboot-parent</name>
Expand Down
2 changes: 1 addition & 1 deletion springboot-starter-data-authorization/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-parent</artifactId>
<version>3.4.34</version>
<version>3.4.35</version>
</parent>

<name>springboot-starter-data-authorization</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
2 changes: 1 addition & 1 deletion springboot-starter-data-fast/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>springboot-parent</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.4.34</version>
<version>3.4.35</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion springboot-starter-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>springboot-parent</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.4.34</version>
<version>3.4.35</version>
</parent>

<name>springboot-starter-flow</name>
Expand Down
2 changes: 1 addition & 1 deletion springboot-starter-security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>springboot-parent</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.4.34</version>
<version>3.4.35</version>
</parent>

<artifactId>springboot-starter-security</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion springboot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-parent</artifactId>
<version>3.4.34</version>
<version>3.4.35</version>
</parent>
<artifactId>springboot-starter</artifactId>

Expand Down