diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/OaReportScheduleServiceImpl.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/OaReportScheduleServiceImpl.java index 76dc7c5..5f8571e 100644 --- a/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/OaReportScheduleServiceImpl.java +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/OaReportScheduleServiceImpl.java @@ -61,11 +61,23 @@ public class OaReportScheduleServiceImpl implements IOaReportScheduleService { private LambdaQueryWrapper buildQueryWrapper(OaReportScheduleBo bo) { Map params = bo.getParams(); LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + + // 其他条件保持不变 lqw.eq(bo.getProjectId() != null, OaReportSchedule::getProjectId, bo.getProjectId()); lqw.like(StringUtils.isNotBlank(bo.getScheduleName()), OaReportSchedule::getScheduleName, bo.getScheduleName()); lqw.eq(bo.getType() != null, OaReportSchedule::getType, bo.getType()); - lqw.eq(bo.getStartDate() != null, OaReportSchedule::getStartDate, bo.getStartDate()); - lqw.eq(bo.getEndDate() != null, OaReportSchedule::getEndDate, bo.getEndDate()); + + // 将等于查询改为范围查询(startDate <= 记录的开始时间 <= endDate) + if (bo.getStartDate() != null && bo.getEndDate() != null) { + lqw.between(OaReportSchedule::getStartDate, bo.getStartDate(), bo.getEndDate()) + .between(OaReportSchedule::getEndDate, bo.getStartDate(), bo.getEndDate()); + } else if (bo.getStartDate() != null) { + lqw.ge(OaReportSchedule::getStartDate, bo.getStartDate()); // 大于等于开始时间 + } else if (bo.getEndDate() != null) { + lqw.le(OaReportSchedule::getEndDate, bo.getEndDate()); // 小于等于结束时间 + } + + // 其他条件保持不变 lqw.eq(bo.getAmount() != null, OaReportSchedule::getAmount, bo.getAmount()); lqw.eq(StringUtils.isNotBlank(bo.getHeader()), OaReportSchedule::getHeader, bo.getHeader()); lqw.eq(StringUtils.isNotBlank(bo.getContactPhone()), OaReportSchedule::getContactPhone, bo.getContactPhone()); @@ -75,6 +87,7 @@ public class OaReportScheduleServiceImpl implements IOaReportScheduleService { lqw.eq(StringUtils.isNotBlank(bo.getAccessory()), OaReportSchedule::getAccessory, bo.getAccessory()); lqw.eq(bo.getSort() != null, OaReportSchedule::getSort, bo.getSort()); lqw.eq(bo.getStatus() != null, OaReportSchedule::getStatus, bo.getStatus()); + return lqw; }