| | |
| | | if (Objects.isNull(warehouse.getName())) { |
| | | throw new CoolException("仓库名称不能为空!!"); |
| | | } |
| | | List<Warehouse> warehouses = warehouseService.list(new LambdaQueryWrapper<Warehouse>().eq(Warehouse::getName, warehouse.getName())); |
| | | if (!warehouses.isEmpty()) { |
| | | throw new CoolException("仓库名称已存在!!"); |
| | | } |
| | | if (!warehouseService.list(new LambdaQueryWrapper<Warehouse>().eq(Warehouse::getCode, warehouse.getCode())).isEmpty()) { |
| | | throw new CoolException("仓库编码已存在!!"); |
| | | } |
| | | |
| | | warehouse.setCreateBy(getLoginUserId()); |
| | | warehouse.setUpdateBy(getLoginUserId()); |
| | | if (!warehouseService.save(warehouse)) { |
| | |
| | | throw new CoolException("仓库名称不能为空!!"); |
| | | } |
| | | warehouse.setUpdateBy(getLoginUserId()); |
| | | |
| | | List<Warehouse> warehouses = warehouseService.list(new LambdaQueryWrapper<Warehouse>().eq(Warehouse::getName, warehouse.getName())); |
| | | if (!warehouses.isEmpty()) { |
| | | throw new CoolException("仓库名称已存在!!"); |
| | | } |
| | | if (!warehouseService.list(new LambdaQueryWrapper<Warehouse>().eq(Warehouse::getCode, warehouse.getCode())).isEmpty()) { |
| | | throw new CoolException("仓库编码已存在!!"); |
| | | } |
| | | |
| | | if (!warehouseService.updateById(warehouse)) { |
| | | return R.error("Update Fail"); |
| | | } |