diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderItemMapper.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderItemMapper.java index c3b7776..4c829ee 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderItemMapper.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderItemMapper.java @@ -115,7 +115,15 @@ public interface TradeOrderItemMapper extends BaseMapperX { if (CollUtil.isEmpty(result)) { return 0; } - Object totalCount = result.get(0).get("total_count"); - return totalCount != null ? ((Number) totalCount).intValue() : 0; + Map 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; } } diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 1a30486..dcded3c 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -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