feat(schedule): 添加排班管理的时间段筛选功能

- 在 WmsAttendanceScheduleBo 中新增 startDate 和 endDate 字段用于时间段筛选
- 更新 mapper 接口方法参数,支持时间段范围查询
- 修改 XML 映射文件,添加时间段条件判断逻辑
- 重构服务实现类,优化分页查询逻辑并支持时间段筛选
- 完善查询方法,统一时间段参数传递机制
This commit is contained in:
2026-05-09 14:23:43 +08:00
parent cd3cfd6198
commit 95c11fbc9a
4 changed files with 55 additions and 35 deletions

View File

@@ -58,7 +58,7 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
// 使用关联查询获取详细信息
List<WmsAttendanceScheduleVo> list = baseMapper.selectScheduleWithDetails(
schedule.getUserId(), schedule.getWorkDate(), schedule.getShiftId());
schedule.getUserId(), schedule.getWorkDate(), schedule.getShiftId(),null, null);
return list.isEmpty() ? null : list.get(0);
}
@@ -68,23 +68,14 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
*/
@Override
public TableDataInfo<WmsAttendanceScheduleVo> queryPageList(WmsAttendanceScheduleBo bo, PageQuery pageQuery) {
Page<WmsAttendanceScheduleVo> page = pageQuery.<WmsAttendanceScheduleVo>build();
List<WmsAttendanceScheduleVo> list = baseMapper.selectScheduleWithDetailsPage(
bo.getUserId(), bo.getWorkDate(), bo.getShiftId(), bo.getShiftName(), bo.getShiftGroup());
// 1. 构建 MP 标准分页对象
Page<WmsAttendanceScheduleVo> page = pageQuery.build();
// 手动分页处理
int total = list.size();
int startNum = (int) ((page.getCurrent() - 1) * page.getSize());
int endNum = Math.min(startNum + (int) page.getSize(), total);
// 2. 调用 Mapper
baseMapper.selectScheduleWithDetailsPage(page, bo);
List<WmsAttendanceScheduleVo> pageList = new ArrayList<>();
if (startNum < total) {
pageList = list.subList(startNum, endNum);
}
Page<WmsAttendanceScheduleVo> result = new Page<>(page.getCurrent(), page.getSize(), total);
result.setRecords(pageList);
return TableDataInfo.build(result);
// 3. 直接返回
return TableDataInfo.build(page);
}
/**
@@ -92,7 +83,8 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
*/
@Override
public List<WmsAttendanceScheduleVo> queryList(WmsAttendanceScheduleBo bo) {
return baseMapper.selectScheduleWithDetails(bo.getUserId(), bo.getWorkDate(), bo.getShiftId());
return baseMapper.selectScheduleWithDetails(bo.getUserId(), bo.getWorkDate(), bo.getShiftId(),
bo.getStartDate(), bo.getEndDate());
}
/**