采购BI汇总,sql逻辑优化

This commit is contained in:
yujh_java 2025-09-22 14:14:07 +08:00
parent 1d001ea77f
commit 5173dccafb

View File

@ -353,12 +353,11 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
" MONTH(DJRQ) AS Month " +
" FROM BO_EU_DWD_ORDER_RKD_HZ " +
" WHERE BKGS = ? " +
" AND DJRQ >= DATE_SUB(?, INTERVAL 2 YEAR) " +
" AND DJRQ >= CONCAT(YEAR(?), '-', LPAD(MONTH(?), 2, '0'), '-01')" +
" GROUP BY WLMC, YEAR(DJRQ), MONTH(DJRQ),SLGC " +
" ) c " +
" WHERE c.Year IN (YEAR(?), YEAR(?) + 1) " +
" ORDER BY c.Year, c.Month";
List<RowMap> currentMonthData = DBSql.getMaps(currentMonthSql, bkgs, startDate,startDate,startDate);
List<RowMap> currentMonthData = DBSql.getMaps(currentMonthSql, bkgs, startDate,startDate);
if (currentMonthData==null){
return;
}
@ -430,12 +429,11 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
" MONTH(DJRQ) AS Month " +
" FROM BO_EU_DWD_ORDER_RKD_HZ " +
" WHERE BKGS = ? " +
" AND DJRQ >= DATE_SUB(?, INTERVAL 2 YEAR) " +
" AND DJRQ >= CONCAT(YEAR(?), '-', LPAD(MONTH(?), 2, '0'), '-01')" +
" GROUP BY WLMC, YEAR(DJRQ), MONTH(DJRQ) " +
" ) c " +
" WHERE c.Year IN (YEAR(?), YEAR(?) + 1) " +
" ORDER BY c.Year, c.Month";
List<RowMap> currentMonthData = DBSql.getMaps(currentMonthSql, bkgs, startDate,startDate,startDate);
List<RowMap> currentMonthData = DBSql.getMaps(currentMonthSql, bkgs, startDate,startDate);
if (currentMonthData==null){
return;
}