From 7edc50bf5b76e0ab2e45b0d2903fa7b04915ec03 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Wed, 28 May 2025 13:06:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E8=8F=9C=E8=B0=B1=E8=8F=9C?= =?UTF-8?q?=E5=93=81=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/canteen/core/cook/domain/CookRecipe.java | 1 + .../canteen/core/cook/mapper/CookRecipeMapper.java | 4 ++++ .../core/cook/service/impl/CookRecipeServiceImpl.java | 10 +++++++++- .../main/resources/mapper/cook/CookRecipeMapper.xml | 11 +++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookRecipe.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookRecipe.java index 5dd2794..9d18d55 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookRecipe.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookRecipe.java @@ -67,5 +67,6 @@ public class CookRecipe extends BaseEntity { @Excel(name = "到期时间", width = 30, dateFormat = "yyyy-MM-dd") private Date expireDate; + private int dishesCount; } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeMapper.java index 5b64dc3..f88e08f 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeMapper.java @@ -29,6 +29,10 @@ public interface CookRecipeMapper { */ public List selectCookRecipeList(CookRecipe cookRecipe); + public int getDishesCount4PointDates(Long recipeId); + + public int getDishesCount4Recycle(Long recipeId); + /** * 新增菜品计划信息 * 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 6e03db9..07180aa 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 @@ -64,7 +64,15 @@ public class CookRecipeServiceImpl implements ICookRecipeService { */ @Override public List selectCookRecipeList(CookRecipe cookRecipe) { - return cookRecipeMapper.selectCookRecipeList(cookRecipe); + List list = cookRecipeMapper.selectCookRecipeList(cookRecipe); + for (CookRecipe recipe : list) { + if (1 == recipe.getRecipeType()) { + recipe.setDishesCount(cookRecipeMapper.getDishesCount4PointDates(recipe.getRecipeId())); + } else { + recipe.setDishesCount(cookRecipeMapper.getDishesCount4Recycle(recipe.getRecipeId())); + } + } + return list; } /** diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeMapper.xml index 3d35990..95530d1 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeMapper.xml @@ -43,6 +43,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and cr.expire_date = #{expireDate} + + + +