fix(cost): 修复报表日期格式化问题

- 修改了报告日期的格式化逻辑,使用 SimpleDateFormat 替代直接字符串拼接
- 确保日期格式统一为 yyyy-MM 格式进行查询匹配
- 避免了可能的日期格式不一致导致的查询错误
This commit is contained in:
2026-06-17 14:40:39 +08:00
parent 791be3e1a5
commit 3719416cbf

View File

@@ -71,7 +71,10 @@ public class CostProdReportServiceImpl implements ICostProdReportService {
lqw.eq(StringUtils.isNotBlank(bo.getLineType()), CostProdReport::getLineType, bo.getLineType());
lqw.eq(bo.getInputWeight() != null, CostProdReport::getInputWeight, bo.getInputWeight());
lqw.eq(bo.getOutputWeight() != null, CostProdReport::getOutputWeight, bo.getOutputWeight());
lqw.apply(bo.getReportDate() != null, "DATE_FORMAT(report_date, '%Y-%m') = {0}", bo.getReportDate());
if (bo.getReportDate() != null) {
String monthStr = new java.text.SimpleDateFormat("yyyy-MM").format(bo.getReportDate());
lqw.apply("DATE_FORMAT(report_date, '%Y-%m') = {0}", monthStr);
}
return lqw;
}