refactor: 优化字符串模板方法 API 使用

This commit is contained in:
2024-02-18 22:44:06 +08:00
parent 89108ad55a
commit c9867844b6
12 changed files with 16 additions and 16 deletions

View File

@@ -102,7 +102,7 @@ public class DataPermissionHandlerImpl implements DataPermissionHandler {
case DEPT -> expression = this.buildDeptExpression(dataPermission, currentUser, expression);
case SELF -> expression = this.buildSelfExpression(dataPermission, currentUser, expression);
case CUSTOM -> expression = this.buildCustomExpression(dataPermission, role, expression);
default -> throw new IllegalArgumentException(String.format("暂不支持 [%s] 数据权限", dataScope));
default -> throw new IllegalArgumentException("暂不支持 [%s] 数据权限".formatted(dataScope));
}
}
return null != where ? new AndExpression(where, new Parenthesis(expression)) : expression;
@@ -227,7 +227,7 @@ public class DataPermissionHandlerImpl implements DataPermissionHandler {
*/
private Column buildColumn(String tableAlias, String columnName) {
if (StringUtils.isNotEmpty(tableAlias)) {
return new Column(String.format("%s.%s", tableAlias, columnName));
return new Column("%s.%s".formatted(tableAlias, columnName));
}
return new Column(columnName);
}

View File

@@ -182,7 +182,7 @@ public class QueryWrapperHelper {
}
case IS_NULL -> consumers.add(q -> q.isNull(columnName));
case IS_NOT_NULL -> consumers.add(q -> q.isNotNull(columnName));
default -> throw new IllegalArgumentException(String.format("暂不支持 [%s] 查询类型", queryType));
default -> throw new IllegalArgumentException("暂不支持 [%s] 查询类型".formatted(queryType));
}
}
}