diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/mapper/AllocCanteenMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/mapper/AllocCanteenMapper.java index daa92bc..0619103 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/mapper/AllocCanteenMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/mapper/AllocCanteenMapper.java @@ -60,5 +60,5 @@ public interface AllocCanteenMapper { */ public int deleteAllocCanteenByCanteenIds(Long[] canteenIds); - public int selectAllocCanteenCountByAreaIds(Long[] areaIds); + public int getAllocCanteenCountByAreaIds(Long[] areaIds); } 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 4b147cc..bbe09e6 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 @@ -9,6 +9,7 @@ import java.util.stream.Collectors; 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.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; @@ -29,6 +30,8 @@ public class AllocAreaServiceImpl implements IAllocAreaService { private AllocAreaMapper allocAreaMapper; @Autowired private AllocCanteenMapper allocCanteenMapper; + @Autowired + private SupermarketInfoMapper supermarketInfoMapper; @Override public List selectAreaTreeList(AllocArea area) { @@ -108,9 +111,13 @@ public class AllocAreaServiceImpl implements IAllocAreaService { */ @Override public int deleteAllocAreaByAreaIds(Long[] areaIds) { - int count = allocCanteenMapper.selectAllocCanteenCountByAreaIds(areaIds); - if (count > 0) { - throw new ServiceException("区域含有食堂信息,不能删除"); + int count1 = allocCanteenMapper.getAllocCanteenCountByAreaIds(areaIds); + if (count1 > 0) { + throw new ServiceException("该区域含有食堂信息,不能删除"); + } + int coun2 = supermarketInfoMapper.getSupermarketCountByAreaIds(areaIds); + if (coun2 > 0) { + throw new ServiceException("该区域含有超市信息,不能删除"); } return allocAreaMapper.deleteAllocAreaByAreaIds(areaIds); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/mapper/SupermarketInfoMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/mapper/SupermarketInfoMapper.java index a42bc84..284deb2 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/mapper/SupermarketInfoMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/mapper/SupermarketInfoMapper.java @@ -57,4 +57,6 @@ public interface SupermarketInfoMapper { * @return 结果 */ public int deleteSupermarketInfoBySupermarketIds(Long[] supermarketIds); + + public int getSupermarketCountByAreaIds(Long[] areaIds); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocCanteenMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocCanteenMapper.xml index 4fb3f70..ef272e6 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocCanteenMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocCanteenMapper.xml @@ -173,7 +173,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select count(1) from alloc_canteen where del_flag = 0 and area_id in diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketInfoMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketInfoMapper.xml index 98b43af..8ee2d54 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketInfoMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketInfoMapper.xml @@ -177,4 +177,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{supermarketId} + + \ No newline at end of file