From 4873c9107b95b5cc465e08e0c644d42703635e92 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Mon, 5 May 2025 11:22:18 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A3=9F=E5=A0=82=E5=90=AB=E6=A1=A3=E5=8F=A3?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E5=88=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canteen/core/alloc/mapper/AllocStallMapper.java | 2 ++ .../core/alloc/service/impl/AllocCanteenServiceImpl.java | 7 +++++++ .../src/main/resources/mapper/alloc/AllocStallMapper.xml | 9 +++++++++ 3 files changed, 18 insertions(+) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/mapper/AllocStallMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/mapper/AllocStallMapper.java index 922d0b4..7a42ef1 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/mapper/AllocStallMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/mapper/AllocStallMapper.java @@ -62,6 +62,8 @@ public interface AllocStallMapper { */ public int deleteAllocStallByStallIds(Long[] stallIds); + public int selectAllocStallCountByCanteenIds(Long[] canteenIds); + public int deleteMealtimeByStallId(Long stallId); public List selectMealtimeByStallId(Long stallId); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenServiceImpl.java index 40a912d..51dd96b 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenServiceImpl.java @@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.bonus.canteen.core.alloc.domain.*; import com.bonus.canteen.core.alloc.mapper.AllocCanteenMapper; +import com.bonus.canteen.core.alloc.mapper.AllocStallMapper; import com.bonus.canteen.core.utils.BnsConstants; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; @@ -28,6 +29,8 @@ import com.bonus.canteen.core.alloc.service.IAllocCanteenService; public class AllocCanteenServiceImpl implements IAllocCanteenService { @Autowired private AllocCanteenMapper allocCanteenMapper; + @Autowired + private AllocStallMapper allocStallMapper; /** * 查询食堂信息 @@ -103,6 +106,10 @@ public class AllocCanteenServiceImpl implements IAllocCanteenService { */ @Override public int deleteAllocCanteenByCanteenIds(Long[] canteenIds) { + int count = allocStallMapper.selectAllocStallCountByCanteenIds(canteenIds); + if (count > 0) { + throw new ServiceException("食堂含有档口信息,不能删除"); + } return allocCanteenMapper.deleteAllocCanteenByCanteenIds(canteenIds); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocStallMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocStallMapper.xml index 0c9da8d..15d181b 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocStallMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocStallMapper.xml @@ -191,6 +191,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + delete from alloc_stall_mealtime where stall_id = #{stallId}