Commit a34e2a16333806732dc1c5d048617e3f3e0ac118

Authored by puff
1 parent 5febfbe4

bugfix:SQL模式only_full_group_by不兼容

src/main/java/com/huaheng/pc/inventory/inventoryTransaction/controller/FrequencyStatisticsController.java
... ... @@ -76,14 +76,18 @@ public class FrequencyStatisticsController extends BaseController {
76 76  
77 77 //物料
78 78 if (type.equals("materialCode")) {
79   - String countSql="SUM(CASE WHEN transactionType = 10 THEN taskQty ELSE 0 END) AS inQty,ABS(SUM(CASE WHEN transactionType = 20 THEN taskQty ELSE 0 END)) AS outQty,SUM(CASE WHEN taskQty > 0 THEN taskQty ELSE 0 END) + ABS(SUM(CASE WHEN taskQty < 0 THEN taskQty ELSE 0 END)) AS taskQty,materialName,materialSpec,materialUnit\n";
  79 + String countSql="SUM(CASE WHEN transactionType = 10 THEN taskQty ELSE 0 END) AS inQty," +
  80 + "ABS(SUM(CASE WHEN transactionType = 20 THEN taskQty ELSE 0 END)) AS outQty," +
  81 + "SUM(CASE WHEN taskQty > 0 THEN taskQty ELSE 0 END) + ABS(SUM(CASE WHEN taskQty < 0 THEN taskQty ELSE 0 END)) AS taskQty," +
  82 + "materialName,materialSpec,materialUnit\n";
80 83 QueryWrapper<InventoryTransaction> materialQueryWrapper = new QueryWrapper<>();
81 84  
82 85 materialQueryWrapper
83 86 .select(type,countSql)
84 87 .like(StringUtils.isNotEmpty(inventoryTransaction.getMaterialCode()), "materialCode", inventoryTransaction.getMaterialCode())//物料编码
85 88 .in("transactionType", 10, 20)
86   - .groupBy(type)
  89 + // 单独materialCode groupby 与SQL模式only_full_group_by不兼容
  90 + .groupBy("materialCode","materialName","materialSpec","materialUnit")
87 91 .ge(StringUtils.isNotEmpty(createdBegin), "created", createdBegin)
88 92 .le(StringUtils.isNotEmpty(createdEnd), "created", createdEnd)
89 93 .orderByDesc("taskQty");
... ...