From c226cc5aec145a31cd88ec05d8d73cfbc4af70f2 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Thu, 15 May 2025 16:03:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=93=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/alloc/service/impl/AllocAreaServiceImpl.java | 7 +++++++ .../core/warehouse/mapper/WarehouseInfoMapper.java | 2 ++ .../resources/mapper/warehouse/WarehouseInfoMapper.xml | 9 +++++++++ 3 files changed, 18 insertions(+) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocAreaServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocAreaServiceImpl.java index bbe09e6..c4859ca 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocAreaServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocAreaServiceImpl.java @@ -10,6 +10,7 @@ import com.bonus.canteen.core.alloc.mapper.AllocCanteenMapper; import com.bonus.canteen.core.common.domain.TreeSelect; import com.bonus.canteen.core.alloc.mapper.AllocAreaMapper; import com.bonus.canteen.core.supermarket.mapper.SupermarketInfoMapper; +import com.bonus.canteen.core.warehouse.mapper.WarehouseInfoMapper; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; @@ -32,6 +33,8 @@ public class AllocAreaServiceImpl implements IAllocAreaService { private AllocCanteenMapper allocCanteenMapper; @Autowired private SupermarketInfoMapper supermarketInfoMapper; + @Autowired + WarehouseInfoMapper warehouseInfoMapper; @Override public List selectAreaTreeList(AllocArea area) { @@ -119,6 +122,10 @@ public class AllocAreaServiceImpl implements IAllocAreaService { if (coun2 > 0) { throw new ServiceException("该区域含有超市信息,不能删除"); } + int coun3 = warehouseInfoMapper.getWarehouseCountByAreaIds(areaIds); + if (coun3 > 0) { + throw new ServiceException("该区域含有仓库信息,不能删除"); + } return allocAreaMapper.deleteAllocAreaByAreaIds(areaIds); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/warehouse/mapper/WarehouseInfoMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/warehouse/mapper/WarehouseInfoMapper.java index 558f34b..997d237 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/warehouse/mapper/WarehouseInfoMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/warehouse/mapper/WarehouseInfoMapper.java @@ -57,4 +57,6 @@ public interface WarehouseInfoMapper { * @return 结果 */ public int deleteWarehouseInfoByWarehouseIds(Long[] warehouseIds); + + public int getWarehouseCountByAreaIds(Long[] areaIds); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/warehouse/WarehouseInfoMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/warehouse/WarehouseInfoMapper.xml index 76db896..a4dd757 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/warehouse/WarehouseInfoMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/warehouse/WarehouseInfoMapper.xml @@ -152,4 +152,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{warehouseId} + + \ No newline at end of file