diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/mapper/BasicStallMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/mapper/BasicStallMapper.java index 9aa3a76..dedeeb3 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/mapper/BasicStallMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/mapper/BasicStallMapper.java @@ -46,6 +46,8 @@ public interface BasicStallMapper { */ public int updateBasicStall(BasicStall basicStall); + public int updateStallToNewAreaId(BasicStall basicStall); + /** * 删除档口信息 * diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/service/impl/BasicCanteenServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/service/impl/BasicCanteenServiceImpl.java index f0b23b8..dbeba78 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/service/impl/BasicCanteenServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/service/impl/BasicCanteenServiceImpl.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Objects; import java.util.stream.Collectors; +import com.bonus.canteen.core.basic.domain.BasicStall; import com.bonus.canteen.core.basic.mapper.BasicStallMapper; import com.bonus.canteen.core.utils.BnsConstants; import com.bonus.common.core.exception.ServiceException; @@ -90,7 +91,13 @@ public class BasicCanteenServiceImpl implements IBasicCanteenService { if (otherCanteenNameList.contains(basicCanteen.getCanteenName())) { throw new ServiceException("该区域食堂名称已存在"); } - return basicCanteenMapper.updateBasicCanteen(basicCanteen); + int count = basicCanteenMapper.updateBasicCanteen(basicCanteen); + //食堂更换区域id时,同时更换档口区域id + BasicStall basicStall = new BasicStall(); + basicStall.setAreaId(basicCanteen.getAreaId()); + basicStall.setCanteenId(basicCanteen.getCanteenId()); + basicStallMapper.updateStallToNewAreaId(basicStall); + return count; } catch (Exception e) { throw new ServiceException(e.getMessage()); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/basic/BasicStallMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/basic/BasicStallMapper.xml index bc51e95..42abd42 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/basic/BasicStallMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/basic/BasicStallMapper.xml @@ -159,6 +159,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where stall_id = #{stallId} + + update basic_stall set area_id = #{areaId} + where canteen_id = #{canteenId} + + update basic_stall set del_flag = '2' where stall_id = #{stallId}