Commit d4503124 authored by wanglong's avatar wanglong

增加删除判断 多选删除

parent 40d50d15
...@@ -11,9 +11,11 @@ import com.yeejoin.amos.boot.module.ugp.api.dto.WelderDto; ...@@ -11,9 +11,11 @@ import com.yeejoin.amos.boot.module.ugp.api.dto.WelderDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Attachment; import com.yeejoin.amos.boot.module.ugp.api.entity.Attachment;
import com.yeejoin.amos.boot.module.ugp.api.entity.Company; import com.yeejoin.amos.boot.module.ugp.api.entity.Company;
import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment; import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProjectResource;
import com.yeejoin.amos.boot.module.ugp.api.mapper.AttachmentMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.AttachmentMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectResourceMapper;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify; import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.AttachmentServiceImpl; import com.yeejoin.amos.boot.module.ugp.biz.service.impl.AttachmentServiceImpl;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.OrgServiceImpl; import com.yeejoin.amos.boot.module.ugp.biz.service.impl.OrgServiceImpl;
...@@ -66,6 +68,8 @@ public class EquipmentController extends BaseController { ...@@ -66,6 +68,8 @@ public class EquipmentController extends BaseController {
@Autowired @Autowired
OrgServiceImpl orgService; OrgServiceImpl orgService;
@Autowired
ProjectResourceMapper projectResourceMapper;
/** /**
* 新增设备信息表 * 新增设备信息表
...@@ -108,8 +112,17 @@ public class EquipmentController extends BaseController { ...@@ -108,8 +112,17 @@ public class EquipmentController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@DeleteMapping(value = "/{sequenceNbr}") @DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除设备信息表", notes = "根据sequenceNbr删除设备信息表") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除设备信息表", notes = "根据sequenceNbr删除设备信息表")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") List<Long> sequenceNbr) throws Exception {
return ResponseHelper.buildResponse(equipmentServiceImpl.removeById(sequenceNbr)); LambdaQueryWrapper<ProjectResource> wrapper = new LambdaQueryWrapper<>();
for (Long i:sequenceNbr){
wrapper.eq(ProjectResource::getResourceId,i);
if (!projectResourceMapper.selectList(wrapper).isEmpty()){
throw new Exception("无法删除,已绑定项目");
}
}
return ResponseHelper.buildResponse(equipmentServiceImpl.removeByIds(sequenceNbr));
} }
/** /**
......
...@@ -2,18 +2,21 @@ package com.yeejoin.amos.boot.module.ugp.biz.controller; ...@@ -2,18 +2,21 @@ package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProjectResource;
import com.yeejoin.amos.boot.module.ugp.api.mapper.AttachmentMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.AttachmentMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectResourceMapper;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify; import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.AttachmentServiceImpl; import com.yeejoin.amos.boot.module.ugp.biz.service.impl.*;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.EquipmentServiceImpl;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.OrgServiceImpl;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.MaterialServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -43,6 +46,8 @@ public class MaterialController extends BaseController { ...@@ -43,6 +46,8 @@ public class MaterialController extends BaseController {
AttachmentMapper attachmentMapper; AttachmentMapper attachmentMapper;
@Autowired @Autowired
OrgServiceImpl orgService; OrgServiceImpl orgService;
@Autowired
ProjectResourceMapper projectResourceMapper;
/** /**
...@@ -81,9 +86,19 @@ public class MaterialController extends BaseController { ...@@ -81,9 +86,19 @@ public class MaterialController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@DeleteMapping(value = "/{sequenceNbr}") @DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除材料信息表", notes = "根据sequenceNbr删除材料信息表") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除材料信息表", notes = "根据sequenceNbr删除材料信息表")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") List<Long> sequenceNbr) throws Exception {
return ResponseHelper.buildResponse(materialServiceImpl.removeById(sequenceNbr));
} LambdaQueryWrapper<ProjectResource> wrapper = new LambdaQueryWrapper<>();
for (Long i:sequenceNbr){
wrapper.eq(ProjectResource::getResourceId,i);
if (!projectResourceMapper.selectList(wrapper).isEmpty()){
throw new Exception("无法删除,已绑定项目");
}
}
return ResponseHelper.buildResponse(materialServiceImpl.removeByIds(sequenceNbr));
}
/** /**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
......
package com.yeejoin.amos.boot.module.ugp.biz.controller; package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProjectResource;
import com.yeejoin.amos.boot.module.ugp.api.entity.Weld; import com.yeejoin.amos.boot.module.ugp.api.entity.Weld;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectResourceMapper;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -37,6 +40,8 @@ public class WeldController extends BaseController { ...@@ -37,6 +40,8 @@ public class WeldController extends BaseController {
@Autowired @Autowired
WeldServiceImpl weldServiceImpl; WeldServiceImpl weldServiceImpl;
@Autowired
ProjectResourceMapper projectResourceMapper;
/** /**
* 新增焊口信息表 * 新增焊口信息表
...@@ -74,8 +79,16 @@ public class WeldController extends BaseController { ...@@ -74,8 +79,16 @@ public class WeldController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}") @DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除焊口信息表", notes = "根据sequenceNbr删除焊口信息表") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除焊口信息表", notes = "根据sequenceNbr删除焊口信息表")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") List<Long> sequenceNbr) throws Exception {
return ResponseHelper.buildResponse(weldServiceImpl.removeById(sequenceNbr)); LambdaQueryWrapper<ProjectResource> wrapper = new LambdaQueryWrapper<>();
for (Long i:sequenceNbr){
wrapper.eq(ProjectResource::getResourceId,i);
if (!projectResourceMapper.selectList(wrapper).isEmpty()){
throw new Exception("无法删除,已绑定项目");
}
}
return ResponseHelper.buildResponse(weldServiceImpl.removeByIds(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