fix(cost): 修复报表日期格式化问题
- 修改了报告日期的格式化逻辑,使用 SimpleDateFormat 替代直接字符串拼接 - 确保日期格式统一为 yyyy-MM 格式进行查询匹配 - 避免了可能的日期格式不一致导致的查询错误
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user