feat(wms/attendance): 新增排班班次批量修改功能
在IWmsAttendanceScheduleService接口、WmsAttendanceScheduleController控制器和WmsAttendanceScheduleServiceImpl服务实现类中新增batchUpdateShiftByIds方法,支持通过主键ID列表批量更新排班记录的班次。新增BatchUpdateScheduleItemBo业务对象用于接收批量更新项,包含scheduleId和shiftId字段并进行非空校验。Controller层提供/batchUpdateShift端点,使用PUT请求并应用防重复提交和操作日志注解。Service层实现遍历列表并利用MyBatis-Plus的UpdateWrapper进行批量更新,确保事务一致性。
This commit is contained in:
@@ -5,6 +5,7 @@ import com.klp.domain.vo.WmsAttendanceScheduleVo;
|
||||
import com.klp.domain.bo.WmsAttendanceScheduleBo;
|
||||
import com.klp.domain.bo.GenerateScheduleBo;
|
||||
import com.klp.domain.bo.BatchUpdateScheduleBo;
|
||||
import com.klp.domain.bo.BatchUpdateScheduleItemBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
@@ -58,4 +59,9 @@ public interface IWmsAttendanceScheduleService {
|
||||
* 批量修改指定日期多个员工的班次
|
||||
*/
|
||||
void batchUpdateSchedule(BatchUpdateScheduleBo bo);
|
||||
|
||||
/**
|
||||
* 批量修改排班班次(按主键)
|
||||
*/
|
||||
void batchUpdateShiftByIds(List<BatchUpdateScheduleItemBo> list);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import com.klp.domain.bo.WmsAttendanceScheduleBo;
|
||||
import com.klp.domain.bo.GenerateScheduleBo;
|
||||
import com.klp.domain.bo.BatchUpdateScheduleBo;
|
||||
import com.klp.domain.bo.BatchUpdateScheduleItemBo;
|
||||
import com.klp.domain.vo.WmsAttendanceScheduleVo;
|
||||
import com.klp.domain.WmsAttendanceSchedule;
|
||||
import com.klp.domain.WmsAttendanceShiftRule;
|
||||
@@ -178,6 +179,22 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改排班班次(按主键)
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchUpdateShiftByIds(List<BatchUpdateScheduleItemBo> list) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (BatchUpdateScheduleItemBo item : list) {
|
||||
baseMapper.update(null, Wrappers.<WmsAttendanceSchedule>lambdaUpdate()
|
||||
.eq(WmsAttendanceSchedule::getScheduleId, item.getScheduleId())
|
||||
.set(WmsAttendanceSchedule::getShiftId, item.getShiftId()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改指定日期多个员工的班次
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user