From e557e31739bf6274f1af8c825dc7ce548a1a9953 Mon Sep 17 00:00:00 2001 From: wangwei <1610949092@qq.com> Date: Thu, 2 Feb 2023 11:20:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/thrsys/ThrDeptController.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/thrsys/ThrDeptController.java b/src/main/java/com/glxp/api/controller/thrsys/ThrDeptController.java index cc7d8163..d1e17304 100644 --- a/src/main/java/com/glxp/api/controller/thrsys/ThrDeptController.java +++ b/src/main/java/com/glxp/api/controller/thrsys/ThrDeptController.java @@ -88,7 +88,7 @@ public class ThrDeptController { @PostMapping("/spms/thrsys/warehouse/edit") public BaseResponse edit(@RequestBody @Valid ThrDeptEntity thrDeptEntity, - BindingResult bindingResult,FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) { + BindingResult bindingResult,FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest,FilterThrDeptRequest filterThrDeptRequest) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); @@ -106,13 +106,23 @@ public class ThrDeptController { //修改仓库 thrInvWarehouseService.updateThrInvWarehouse(thrInvWarehouseEntity); } - thrDeptEntity.setPid(null); // 不能修改父级 pid - thrDeptEntity.setUpdateTime(new Date()); - boolean b = thrDeptService.updateInvWarehouse(thrDeptEntity); - if (!b) { - return ResultVOUtils.error(ResultEnum.NOT_NETWORK); + //判断部门是否存在 + filterThrDeptRequest.setCode(thrDeptEntity.getCode()); + filterThrDeptRequest.setName(thrDeptEntity.getName()); + filterThrDeptRequest.setThirdSysFk(thrDeptEntity.getThirdSysFk()); + List thrDeptEntities = thrDeptService.filterThrInvWarehouse(filterThrDeptRequest); + if(thrDeptEntities.size()==0){ + thrDeptEntity.setPid(null); // 不能修改父级 pid + thrDeptEntity.setUpdateTime(new Date()); + boolean b = thrDeptService.updateInvWarehouse(thrDeptEntity); + if (!b) { + return ResultVOUtils.error(ResultEnum.NOT_NETWORK); + } + return ResultVOUtils.success(); + }else{ + return ResultVOUtils.error(ResultEnum.DATA_REPEAT); } - return ResultVOUtils.success(); + } @PostMapping("/spms/thrsys/warehouse/delete")