From cba0e5bc7b9d7c70b5aa876ec7b52f502ae86a53 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Tue, 3 Jun 2025 09:56:19 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=B6=85=E5=B8=82?= =?UTF-8?q?=E5=8E=9F=E6=96=99=E6=97=B6=E5=8A=A0=E4=BF=9D=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../supermarket/mapper/SupermarketProductMapper.java | 2 ++ .../service/impl/SupermarketMaterialServiceImpl.java | 10 ++++++++++ .../mapper/supermarket/SupermarketProductMapper.xml | 12 +++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/mapper/SupermarketProductMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/mapper/SupermarketProductMapper.java index a7f4edb..ffb466c 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/mapper/SupermarketProductMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/mapper/SupermarketProductMapper.java @@ -18,6 +18,8 @@ public interface SupermarketProductMapper { */ public SupermarketProduct selectSupermarketProductByProductId(Long productId); + public List selectSupermarketProductByMaterialIds(Long[] materialIds); + /** * 查询超市商城商品列表 * diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/service/impl/SupermarketMaterialServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/service/impl/SupermarketMaterialServiceImpl.java index a4e38bd..a0bb2b1 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/service/impl/SupermarketMaterialServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/service/impl/SupermarketMaterialServiceImpl.java @@ -1,6 +1,9 @@ package com.bonus.canteen.core.supermarket.service.impl; import java.util.List; + +import com.bonus.canteen.core.supermarket.domain.SupermarketProduct; +import com.bonus.canteen.core.supermarket.mapper.SupermarketProductMapper; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -8,6 +11,7 @@ import org.springframework.stereotype.Service; import com.bonus.canteen.core.supermarket.mapper.SupermarketMaterialMapper; import com.bonus.canteen.core.supermarket.domain.SupermarketMaterial; import com.bonus.canteen.core.supermarket.service.ISupermarketMaterialService; +import org.springframework.util.CollectionUtils; /** * 商品信息Service业务层处理 @@ -19,6 +23,8 @@ import com.bonus.canteen.core.supermarket.service.ISupermarketMaterialService; public class SupermarketMaterialServiceImpl implements ISupermarketMaterialService { @Autowired private SupermarketMaterialMapper supermarketMaterialMapper; + @Autowired + private SupermarketProductMapper supermarketProductMapper; /** * 查询商品信息 @@ -82,6 +88,10 @@ public class SupermarketMaterialServiceImpl implements ISupermarketMaterialServi */ @Override public int deleteSupermarketMaterialByMaterialIds(Long[] materialIds) { + List list = supermarketProductMapper.selectSupermarketProductByMaterialIds(materialIds); + if (!CollectionUtils.isEmpty(list)) { + throw new ServiceException("该原料下含有商品,不能删除"); + } return supermarketMaterialMapper.deleteSupermarketMaterialByMaterialIds(materialIds); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketProductMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketProductMapper.xml index c202325..7eb5dda 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketProductMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketProductMapper.xml @@ -22,7 +22,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select product_id, supermarket_id, material_id, putaway_state, if_online, sale_price, pref_price, person_limit, one_day_limit, img_url, inventory_num, create_by, create_time, update_by, update_time from supermarket_product + select product_id, supermarket_id, material_id, putaway_state, if_online, sale_price, pref_price, + person_limit, one_day_limit, img_url, inventory_num, create_by, create_time, update_by, update_time + from supermarket_product + + insert into supermarket_product From 9dc14fe69a36ef8f84a06b4944b0c3b3d34cbf38 Mon Sep 17 00:00:00 2001 From: jjLv <1981429112@qq.com> Date: Tue, 3 Jun 2025 10:20:56 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E9=A3=9F=E5=A0=82-=E8=8F=9C=E5=93=81?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/cook/CookDishesMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookDishesMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookDishesMapper.xml index 3751faf..980dcd5 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookDishesMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookDishesMapper.xml @@ -165,7 +165,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and cd.glycemic_index = #{glycemicIndex} and cd.sort = #{sort} and cd.canteen_id = #{canteenId} - and cd.shopstall_id = #{stallId} + and (cd.shopstall_id = #{stallId} or cd.shopstall_id is null or cd.shopstall_id == '') and cd.hide_flag = #{hideFlag} and cd.convert_flag = #{convertFlag} and cd.material_cost = #{materialCost} From 72dc664e10f827314c5d74f9ffe2b6600a4fd701 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Tue, 3 Jun 2025 10:28:27 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=B6=85=E5=B8=82?= =?UTF-8?q?=E5=8E=9F=E6=96=99=E6=97=B6=E5=8A=A0=E4=BF=9D=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mapper/supermarket/SupermarketProductMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketProductMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketProductMapper.xml index 7eb5dda..715925f 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketProductMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketProductMapper.xml @@ -48,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where product_id = #{productId} - where material_id in From ad6e3932dfdd4f039cbf642afba919a9da484c7d Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Tue, 3 Jun 2025 10:32:39 +0800 Subject: [PATCH 4/4] =?UTF-8?q?h5=E9=A2=84=E8=AE=A2=E9=A4=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/cook/CookH5Mapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookH5Mapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookH5Mapper.xml index ff8587c..af20f52 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookH5Mapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookH5Mapper.xml @@ -139,7 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join basic_canteen ac on mr.canteen_id = ac.canteen_id left join basic_stall ass on mr.stall_id = ass.stall_id where - bind_type = 2 + bind_type = 2 and mr.del_flag = '0'