修复取值问题

This commit is contained in:
zjf committed 2026-02-22 18:04:55 +08:00
1 parent 1bb89a854e
commit 75c942c5c8
2 files changed
+13 -5

No files matched your search

@@ -115,7 +115,15 @@ public interface TradeOrderItemMapper extends BaseMapperX<TradeOrderItemDO> {
if (CollUtil.isEmpty(result)) {
return 0;
}
Object totalCount = result.get(0).get("total_count");
return totalCount != null ? ((Number) totalCount).intValue() : 0;
Map<String, Object> first = CollUtil.getFirst(result);
if (first == null) {
return 0;
}
// 兼容不同数据库返回列名大小写(total_count / TOTAL_COUNT)
Object totalCount = first.get("total_count");
if (totalCount == null) {
totalCount = first.get("TOTAL_COUNT");
}
return totalCount instanceof Number ? ((Number) totalCount).intValue() : 0;
}
}
@@ -46,9 +46,9 @@ spring:
primary: master
datasource:
master:
# url: jdbc:mysql://123.157.250.162:37897/xr?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
# username: xr
# password: zd5ecNxeXHZxkWs8
# url: jdbc:mysql://123.157.250.162:37897/xr_v2?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
# username: xr_v2
# password: GR6DMKkyXAxcZSe4
url: jdbc:mysql://127.0.0.1:3306/xr_v2?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
username: root
password: root