Skip to content

Commit 8bebd9f

Browse files
committed
fix 3.3.45
1 parent c562f71 commit 8bebd9f

File tree

16 files changed

+45
-20
lines changed

16 files changed

+45
-20
lines changed

example/example-application/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.44</version>
8+
<version>3.3.45</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/example-domain/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.44</version>
8+
<version>3.3.45</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/example-infra-flow/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.44</version>
8+
<version>3.3.45</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/example-infra-jpa/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.44</version>
8+
<version>3.3.45</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/example-server/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.44</version>
8+
<version>3.3.45</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</parent>
1818

1919
<artifactId>springboot-example</artifactId>
20-
<version>3.3.44</version>
20+
<version>3.3.45</version>
2121

2222
<name>springboot-example</name>
2323
<description>springboot-example project for Spring Boot</description>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<groupId>com.codingapi.springboot</groupId>
1717
<artifactId>springboot-parent</artifactId>
18-
<version>3.3.44</version>
18+
<version>3.3.45</version>
1919

2020
<url>https://github.com/codingapi/springboot-framewrok</url>
2121
<name>springboot-parent</name>

springboot-starter-data-authorization/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.codingapi.springboot</groupId>
88
<artifactId>springboot-parent</artifactId>
9-
<version>3.3.44</version>
9+
<version>3.3.45</version>
1010
</parent>
1111

1212
<artifactId>springboot-starter-data-authorization</artifactId>

springboot-starter-data-authorization/src/main/java/com/codingapi/springboot/authorization/enhancer/TableColumnAliasHolder.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@ private void searchSubSelect(String parent, PlainSelect plainSelect) {
4242
// FROM 项是表
4343
if (fromItem instanceof Table) {
4444
this.appendTableAlias(fromItem);
45-
this.appendColumnAlias(parent, plainSelect.getSelectItems());
45+
Table table = (Table) fromItem;
46+
this.appendColumnAlias(parent, table.getName(), plainSelect.getSelectItems());
4647
}
4748

4849

4950
// FROM是子查询
5051
if (fromItem instanceof Select) {
5152
PlainSelect subPlainSelect = ((Select) fromItem).getPlainSelect();
52-
this.appendColumnAlias(parent, plainSelect.getSelectItems());
53+
this.appendColumnAlias(parent, null, plainSelect.getSelectItems());
5354
parent = fromItem.getAlias().getName();
5455
this.searchSubSelect(parent, subPlainSelect);
5556
}
@@ -60,14 +61,15 @@ private void searchSubSelect(String parent, PlainSelect plainSelect) {
6061
if (join.getRightItem() instanceof Select) {
6162
FromItem currentItem = join.getRightItem();
6263
PlainSelect subPlainSelect = ((Select) currentItem).getPlainSelect();
63-
this.appendColumnAlias(parent, plainSelect.getSelectItems());
64+
this.appendColumnAlias(parent, null, plainSelect.getSelectItems());
6465
parent = currentItem.getAlias().getName();
6566
this.searchSubSelect(parent, subPlainSelect);
6667
}
6768
if (join.getRightItem() instanceof Table) {
6869
FromItem currentItem = join.getRightItem();
6970
this.appendTableAlias(currentItem);
70-
this.appendColumnAlias(parent, plainSelect.getSelectItems());
71+
Table table = (Table) currentItem;
72+
this.appendColumnAlias(parent, table.getName(), plainSelect.getSelectItems());
7173
}
7274
}
7375
}
@@ -82,7 +84,7 @@ private void searchSubSelect(String parent, PlainSelect plainSelect) {
8284
private void appendTableAlias(FromItem fromItem) {
8385
Table table = (Table) fromItem;
8486
Alias alias = table.getAlias();
85-
String aliasName = alias!=null?alias.getName():table.getName();
87+
String aliasName = alias != null ? alias.getName() : table.getName();
8688
aliasContext.addTable(aliasName, table.getName());
8789
}
8890

@@ -93,12 +95,14 @@ private void appendTableAlias(FromItem fromItem) {
9395
* @param parent 父表别名
9496
* @param selectItems 列
9597
*/
96-
private void appendColumnAlias(String parent, List<SelectItem<?>> selectItems) {
98+
private void appendColumnAlias(String parent, String tableName, List<SelectItem<?>> selectItems) {
9799
if (selectItems != null) {
98100
for (SelectItem<?> selectItem : selectItems) {
99101
if (selectItem.getExpression() instanceof Column) {
100102
Column column = (Column) selectItem.getExpression();
101-
String tableName = column.getTable().getName();
103+
if (column.getTable() != null) {
104+
tableName = column.getTable().getName();
105+
}
102106
String columnName = column.getColumnName();
103107
Alias columnAlias = selectItem.getAlias();
104108
String aliasName = columnAlias != null ? selectItem.getAlias().getName() : columnName;

springboot-starter-data-authorization/src/test/java/com/codingapi/springboot/authorization/DataAuthorizationContextTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,4 +369,8 @@ public boolean supportRowAuthorization(String tableName, String tableAlias) {
369369
List<Map<String, Object>> data = jdbcTemplate.queryForList(sql);
370370
// System.out.println(data);
371371
}
372+
373+
374+
375+
372376
}

0 commit comments

Comments
 (0)