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 6356cc7..40ba2b6 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 @@ -18,7 +18,7 @@ public interface AllocCanteenMapper { */ public AllocCanteen selectAllocCanteenByCanteenId(Long canteenId); - public AllocCanteen selectAllocCanteenByCanteenName(String canteenName); + public AllocCanteen selectAllocCanteenByCanteenName(AllocCanteen allocCanteen); /** * 查询食堂信息列表 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 c54b35f..40a912d 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 @@ -62,7 +62,7 @@ public class AllocCanteenServiceImpl implements IAllocCanteenService { allocCanteen.setCreateTime(DateUtils.getNowDate()); allocCanteen.setIfReserve(BnsConstants.COMMON_YES); //默认开启预订餐 try { - AllocCanteen checkResult = allocCanteenMapper.selectAllocCanteenByCanteenName(allocCanteen.getCanteenName()); + AllocCanteen checkResult = allocCanteenMapper.selectAllocCanteenByCanteenName(allocCanteen); if (Objects.nonNull(checkResult)) { throw new ServiceException("食堂名称已存在"); } @@ -84,6 +84,7 @@ public class AllocCanteenServiceImpl implements IAllocCanteenService { try { List allCanteenList = allocCanteenMapper.selectAllocCanteenList(new AllocCanteen()); List otherCanteenNameList = allCanteenList.stream().filter(item -> !item.getCanteenId().equals(allocCanteen.getCanteenId())) + .filter(item -> item.getAreaId().equals(allocCanteen.getAreaId())) .map(AllocCanteen::getCanteenName).collect(Collectors.toList()); if (otherCanteenNameList.contains(allocCanteen.getCanteenName())) { throw new ServiceException("食堂名称已存在"); 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 039bfae..81b7277 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 @@ -70,9 +70,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where ac.canteen_id = #{canteenId} - - where ac.canteen_name = #{canteenName} + where ac.canteen_name = #{canteenName} and ac.area_id = #{areaId}