From 85794c2162b9212a5e9dbc2b2c744df2a8653bdc Mon Sep 17 00:00:00 2001 From: wangwei <1610949092@qq.com> Date: Fri, 3 Feb 2023 15:09:24 +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 --- .../thrsys/ThrInvWarehouseController.java | 17 +++++++++++++---- .../mapper/thrsys/ThrInvWarehouseDao.xml | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/thrsys/ThrInvWarehouseController.java b/src/main/java/com/glxp/api/controller/thrsys/ThrInvWarehouseController.java index ba600270..27d23c1b 100644 --- a/src/main/java/com/glxp/api/controller/thrsys/ThrInvWarehouseController.java +++ b/src/main/java/com/glxp/api/controller/thrsys/ThrInvWarehouseController.java @@ -89,7 +89,7 @@ public class ThrInvWarehouseController { @AuthRuleAnnotation("") @PostMapping("/thirdSys/sub/inv/warehouse/edit") public BaseResponse edit(@RequestBody @Valid ThrInvWarehouseEntity invSubWarehouseEntity, - BindingResult bindingResult) { + BindingResult bindingResult,FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest ) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); @@ -97,9 +97,18 @@ public class ThrInvWarehouseController { if (invSubWarehouseEntity.getId() == null) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); } - boolean b = thrInvWarehouseService.updateThrInvWarehouse(invSubWarehouseEntity); - if (!b) { - return ResultVOUtils.error(ResultEnum.NOT_NETWORK); + //先判断该部门下存不存在此仓库 + filterThrSubInvWarehouseRequest.setCode(invSubWarehouseEntity.getCode()); + filterThrSubInvWarehouseRequest.setName(invSubWarehouseEntity.getName()); + filterThrSubInvWarehouseRequest.setParentId(invSubWarehouseEntity.getParentId()); + List thrInvWarehouseEntities = thrInvWarehouseService.filterThrInvWarehouse(filterThrSubInvWarehouseRequest); + if(thrInvWarehouseEntities.size()==0){ + boolean b = thrInvWarehouseService.updateThrInvWarehouse(invSubWarehouseEntity); + if (!b) { + return ResultVOUtils.error(ResultEnum.NOT_NETWORK); + } + }else{ + return ResultVOUtils.error(ResultEnum.DATA_REPEAT); } ThrDeptEntity thrDeptEntity = thrDeptService.selectByCode(invSubWarehouseEntity.getParentId(), invSubWarehouseEntity.getThirdSysFk()); diff --git a/src/main/resources/mybatis/mapper/thrsys/ThrInvWarehouseDao.xml b/src/main/resources/mybatis/mapper/thrsys/ThrInvWarehouseDao.xml index cb96ee4a..924e5a47 100644 --- a/src/main/resources/mybatis/mapper/thrsys/ThrInvWarehouseDao.xml +++ b/src/main/resources/mybatis/mapper/thrsys/ThrInvWarehouseDao.xml @@ -2,7 +2,7 @@ -