Commit 37925ddc authored by KeYong's avatar KeYong

班次删除

parent 601734d0
package com.yeejoin.amos.boot.module.common.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.common.api.entity.DutyPersonShift;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DutyPersonShiftServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -64,7 +69,17 @@ public class DutyPersonShiftController extends BaseController {
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除值班人员日期关联关系表", notes = "根据sequenceNbr删除值班人员日期关联关系表")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(dutyPersonShiftServiceImpl.removeById(sequenceNbr));
DutyPersonShift shift = dutyPersonShiftServiceImpl.getById(sequenceNbr);
Long instanceId = shift.getInstanceId();
Long dateTime = shift.getDutyDate().getTime();
List<Long> shifts = new ArrayList<>();
List<DutyPersonShift> list = dutyPersonShiftServiceImpl.list(new QueryWrapper<DutyPersonShift>().eq("instance_id", instanceId));
list.forEach(x -> {
if (dateTime >= x.getDutyDate().getTime()) {
shifts.add(x.getSequenceNbr());
}
});
return ResponseHelper.buildResponse(dutyPersonShiftServiceImpl.removeByIds(shifts));
}
/**
* 根据sequenceNbr查询
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment