feat(wms): 添加排班管理的查询功能
- 在 WmsAttendanceScheduleMapper 中新增关联查询和批量插入方法 - 实现员工和班次信息的关联查询功能 - 添加分页查询排班列表的详细信息展示 - 扩展 WmsAttendanceScheduleVo 数据传输对象 - 完善排班详情查询和列表查询的服务层逻辑 - 集成员工姓名、部门、岗位及班次时间等详细信息 - 优化批量插入排班数据的功能实现
This commit is contained in:
@@ -64,5 +64,48 @@ public class WmsAttendanceScheduleVo {
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 员工姓名
|
||||
*/
|
||||
@ExcelProperty(value = "员工姓名")
|
||||
private String employeeName;
|
||||
|
||||
/**
|
||||
* 员工部门
|
||||
*/
|
||||
@ExcelProperty(value = "员工部门")
|
||||
private String employeeDept;
|
||||
|
||||
/**
|
||||
* 员工岗位
|
||||
*/
|
||||
@ExcelProperty(value = "员工岗位")
|
||||
private String employeeJobType;
|
||||
|
||||
/**
|
||||
* 班次类型(白班/夜班)
|
||||
*/
|
||||
@ExcelProperty(value = "班次类型")
|
||||
private String shiftType;
|
||||
|
||||
/**
|
||||
* 班次开始时间
|
||||
*/
|
||||
@JsonFormat(pattern = "HH:mm")
|
||||
@ExcelProperty(value = "开始时间")
|
||||
private java.util.Date shiftStartTime;
|
||||
|
||||
/**
|
||||
* 班次结束时间
|
||||
*/
|
||||
@JsonFormat(pattern = "HH:mm")
|
||||
@ExcelProperty(value = "结束时间")
|
||||
private java.util.Date shiftEndTime;
|
||||
|
||||
/**
|
||||
* 工时
|
||||
*/
|
||||
@ExcelProperty(value = "工时")
|
||||
private java.math.BigDecimal workHours;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ package com.klp.mapper;
|
||||
import com.klp.domain.WmsAttendanceSchedule;
|
||||
import com.klp.domain.vo.WmsAttendanceScheduleVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 排班(谁在哪天上班)Mapper接口
|
||||
@@ -12,4 +15,25 @@ import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
*/
|
||||
public interface WmsAttendanceScheduleMapper extends BaseMapperPlus<WmsAttendanceScheduleMapper, WmsAttendanceSchedule, WmsAttendanceScheduleVo> {
|
||||
|
||||
/**
|
||||
* 查询排班列表(关联员工和班次信息)
|
||||
*/
|
||||
List<WmsAttendanceScheduleVo> selectScheduleWithDetails(@Param("userId") Long userId,
|
||||
@Param("workDate") java.util.Date workDate,
|
||||
@Param("shiftId") Long shiftId);
|
||||
|
||||
/**
|
||||
* 分页查询排班列表(关联员工和班次信息)
|
||||
*/
|
||||
List<WmsAttendanceScheduleVo> selectScheduleWithDetailsPage(@Param("userId") Long userId,
|
||||
@Param("workDate") java.util.Date workDate,
|
||||
@Param("shiftId") Long shiftId,
|
||||
@Param("shiftName") String shiftName,
|
||||
@Param("shiftGroup") String shiftGroup);
|
||||
|
||||
/**
|
||||
* 批量插入排班
|
||||
*/
|
||||
boolean insertBatch(@Param("list") List<WmsAttendanceSchedule> list);
|
||||
|
||||
}
|
||||
|
||||
@@ -51,7 +51,16 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
|
||||
*/
|
||||
@Override
|
||||
public WmsAttendanceScheduleVo queryById(Long scheduleId){
|
||||
return baseMapper.selectVoById(scheduleId);
|
||||
WmsAttendanceSchedule schedule = baseMapper.selectById(scheduleId);
|
||||
if (schedule == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 使用关联查询获取详细信息
|
||||
List<WmsAttendanceScheduleVo> list = baseMapper.selectScheduleWithDetails(
|
||||
schedule.getUserId(), schedule.getWorkDate(), schedule.getShiftId());
|
||||
|
||||
return list.isEmpty() ? null : list.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,8 +68,22 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsAttendanceScheduleVo> queryPageList(WmsAttendanceScheduleBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsAttendanceSchedule> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsAttendanceScheduleVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
Page<WmsAttendanceScheduleVo> page = pageQuery.<WmsAttendanceScheduleVo>build();
|
||||
List<WmsAttendanceScheduleVo> list = baseMapper.selectScheduleWithDetailsPage(
|
||||
bo.getUserId(), bo.getWorkDate(), bo.getShiftId(), bo.getShiftName(), bo.getShiftGroup());
|
||||
|
||||
// 手动分页处理
|
||||
int total = list.size();
|
||||
int startNum = (int) ((page.getCurrent() - 1) * page.getSize());
|
||||
int endNum = Math.min(startNum + (int) page.getSize(), total);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -69,19 +92,7 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
|
||||
*/
|
||||
@Override
|
||||
public List<WmsAttendanceScheduleVo> queryList(WmsAttendanceScheduleBo bo) {
|
||||
LambdaQueryWrapper<WmsAttendanceSchedule> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WmsAttendanceSchedule> buildQueryWrapper(WmsAttendanceScheduleBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WmsAttendanceSchedule> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getUserId() != null, WmsAttendanceSchedule::getUserId, bo.getUserId());
|
||||
lqw.eq(bo.getWorkDate() != null, WmsAttendanceSchedule::getWorkDate, bo.getWorkDate());
|
||||
lqw.eq(bo.getShiftId() != null, WmsAttendanceSchedule::getShiftId, bo.getShiftId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getShiftName()), WmsAttendanceSchedule::getShiftName, bo.getShiftName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getShiftGroup()), WmsAttendanceSchedule::getShiftGroup, bo.getShiftGroup());
|
||||
return lqw;
|
||||
return baseMapper.selectScheduleWithDetails(bo.getUserId(), bo.getWorkDate(), bo.getShiftId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user