chore: 优化部分代码

This commit is contained in:
2024-05-31 00:30:45 +08:00
parent 694cbb2850
commit a3391647b5
4 changed files with 18 additions and 18 deletions

View File

@@ -85,7 +85,7 @@ public class GeneratorServiceImpl implements GeneratorService {
List<Table> tableList = MetaUtils.getTables(dataSource);
String tableName = query.getTableName();
if (StrUtil.isNotBlank(tableName)) {
tableList.removeIf(table -> !StrUtil.containsAny(table.getTableName(), tableName));
tableList.removeIf(table -> !StrUtil.containsAnyIgnoreCase(table.getTableName(), tableName));
}
tableList.removeIf(table -> StrUtil.equalsAnyIgnoreCase(table.getTableName(), generatorProperties
.getExcludeTables()));

View File

@@ -146,7 +146,7 @@ public class FileServiceImpl extends BaseServiceImpl<FileMapper, FileDO, FileRes
super.fill(obj);
if (obj instanceof FileResp fileResp && !URLUtils.isHttpUrl(fileResp.getUrl())) {
StorageDO storage = storageService.getById(fileResp.getStorageId());
String prefix = storage.getDomain() + StringConstants.SLASH;
String prefix = StrUtil.appendIfMissing(storage.getDomain(), StringConstants.SLASH);
String url = URLUtil.normalize(prefix + fileResp.getUrl());
fileResp.setUrl(url);
String thumbnailUrl = StrUtils.blankToDefault(fileResp.getThumbnailUrl(), url, thUrl -> URLUtil

View File

@@ -27,14 +27,14 @@ spring.datasource:
password: ${DB_PWD:123456}
driver-class-name: com.mysql.cj.jdbc.Driver
type: ${spring.datasource.type}
# 从库配置(可配多个,构成多从)
slave_1:
url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false
username:
password:
lazy: true
driver-class-name: com.mysql.cj.jdbc.Driver
type: ${spring.datasource.type}
# # 从库配置(可配多个,构成多从)
# slave_1:
# url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false
# username:
# password:
# lazy: true
# driver-class-name: com.mysql.cj.jdbc.Driver
# type: ${spring.datasource.type}
# # PostgreSQL 库配置
# postgresql:
# url: jdbc:postgresql://${DB_HOST:127.0.0.1}:${DB_PORT:5432}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false

View File

@@ -29,14 +29,14 @@ spring.datasource:
password: ${DB_PWD:123456}
driver-class-name: com.mysql.cj.jdbc.Driver
type: ${spring.datasource.type}
# 从库配置(可配多个,构成多从)
slave_1:
url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false
username:
password:
lazy: true
driver-class-name: com.mysql.cj.jdbc.Driver
type: ${spring.datasource.type}
# # 从库配置(可配多个,构成多从)
# slave_1:
# url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false
# username:
# password:
# lazy: true
# driver-class-name: com.mysql.cj.jdbc.Driver
# type: ${spring.datasource.type}
# # PostgreSQL 库配置
# postgresql:
# url: jdbc:postgresql://${DB_HOST:127.0.0.1}:${DB_PORT:5432}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false