From 054c21e9c1717617789ba0bd52591851b3c08401 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Mon, 26 May 2025 16:21:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8F=9C=E8=B0=B1-=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/cook/service/impl/CookRecipeServiceImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java index 68a573c..077067b 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java @@ -20,6 +20,7 @@ import com.bonus.canteen.core.cook.mapper.CookRecipeMapper; import com.bonus.canteen.core.cook.domain.CookRecipe; import com.bonus.canteen.core.cook.service.ICookRecipeService; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; /** * 菜品计划信息Service业务层处理 @@ -81,7 +82,11 @@ public class CookRecipeServiceImpl implements ICookRecipeService { for (CookRecipeDateDTO recipeDateDTO : recipeDateList) { List detailList = recipeDateDTO.getDetailList(); for (CookRecipeDetailDTO detailDTO : detailList) { + if (CollectionUtils.isEmpty(detailDTO.getDishesList())) { + continue; + } CookRecipeDetail cookRecipeDetail = new CookRecipeDetail(); + BeanUtils.copyProperties(recipeDateDTO, detailDTO); BeanUtils.copyProperties(detailDTO, cookRecipeDetail); cookRecipeDetail.setRecipeId(cookRecipeDTO.getRecipeId()); cookRecipeDetailMapper.insertCookRecipeDetail(cookRecipeDetail); //插入菜谱之执行计划 @@ -89,7 +94,7 @@ public class CookRecipeServiceImpl implements ICookRecipeService { for (CookRecipeDishesDTO dishesDTO : dishesList) { CookRecipeDishes cookRecipeDishes = new CookRecipeDishes(); BeanUtils.copyProperties(dishesDTO, cookRecipeDishes); - cookRecipeDishes.setRecipeDetailId(detailDTO.getRecipeDetailId()); + cookRecipeDishes.setRecipeDetailId(cookRecipeDetail.getRecipeDetailId()); cookRecipeDishesMapper.insertCookRecipeDishes(cookRecipeDishes); //插入菜谱之菜品详情 } }