Merge branch 'master' into report

This commit is contained in:
gaowdong 2025-06-03 09:15:25 +08:00
commit 3fbe95be95
8 changed files with 123 additions and 87 deletions

View File

@ -1,9 +1,12 @@
package com.bonus.canteen.core.common.utils; package com.bonus.canteen.core.common.utils;
import com.bonus.common.houqin.constant.GlobalConstants;
import java.time.DayOfWeek; import java.time.DayOfWeek;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.temporal.TemporalAdjusters; import java.time.temporal.TemporalAdjusters;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
public class DateUtil { public class DateUtil {
@ -27,4 +30,14 @@ public class DateUtil {
return dates; return dates;
} }
public static HashMap<Integer, LocalDate> getDaysInWeekMap() {
LocalDate now = LocalDate.now();
HashMap<Integer, LocalDate> dateHashMap = new HashMap<>();
for (int i = 0; i < GlobalConstants.WEEK_DAYS; ++i) {
LocalDate applyWeek = now.plusDays((long) i);
dateHashMap.put(applyWeek.getDayOfWeek().getValue(), applyWeek);
}
return dateHashMap;
}
} }

View File

@ -65,9 +65,11 @@ public interface CookRecipeDetailMapper {
public List<Long> getToDeleteCookRecipeDetailIds4PointDays(@Param("recipeId") Long recipeId, @Param("dateList") List<LocalDate> dateList); public List<Long> getToDeleteCookRecipeDetailIds4PointDays(@Param("recipeId") Long recipeId, @Param("dateList") List<LocalDate> dateList);
public List<Long> getToDeleteCookRecipeDetailIds4Daily(Long recipeId); public List<Long> getToDeleteCookRecipeDetailIds4Daily(@Param("recipeId") Long recipeId);
public List<Long> getToDeleteCookRecipeDetailIds4Weekly(Long recipeId); public List<Long> getToDeleteCookRecipeDetailIds4WeeklyTemplate(@Param("recipeId") Long recipeId, @Param("applyWeeks") List<Long> applyWeeks);
public List<Long> getToDeleteCookRecipeDetailIds4WeeklyDetail(@Param("recipeId")Long recipeId, @Param("dateList") List<LocalDate> dateList);
List<CookRecipeDetail> getCookRecipeDetailLTemplate(@Param("recipeId") Long recipeId, @Param("detailType") String detailType); List<CookRecipeDetail> getCookRecipeDetailLTemplate(@Param("recipeId") Long recipeId, @Param("detailType") String detailType);

View File

@ -201,6 +201,34 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
throw new ServiceException("该菜谱名称已存在,请重新输入"); throw new ServiceException("该菜谱名称已存在,请重新输入");
} }
int count = cookRecipeMapper.insertCookRecipe(cookRecipeDTO); //插入菜谱 int count = cookRecipeMapper.insertCookRecipe(cookRecipeDTO); //插入菜谱
createRecipeDetails(cookRecipeDTO); //创建详情+菜品数据
return count;
} catch (Exception e) {
throw new ServiceException(e.getMessage());
}
}
/**
* 修改菜品计划信息
*
* @param cookRecipeDTO 菜品计划信息
* @return 结果
*/
@Override
public int updateCookRecipe(CookRecipeDTO cookRecipeDTO) {
cookRecipeDTO.setUpdateTime(DateUtils.getNowDate());
cookRecipeDTO.setUpdateBy(SecurityUtils.getUsername());
try {
List<CookRecipe> cookRecipes = cookRecipeMapper.selectCookRecipeList(new CookRecipe());
List<String> otherCookRecipes = cookRecipes.stream().filter(item -> !item.getRecipeId().equals(cookRecipeDTO.getRecipeId()))
.map(CookRecipe::getRecipeName).collect(Collectors.toList());
if (otherCookRecipes.contains(cookRecipeDTO.getRecipeName())) {
throw new ServiceException("该菜谱名称已存在,请重新输入");
}
int count = cookRecipeMapper.updateCookRecipe(cookRecipeDTO);
// 删除旧的详情+菜品数据
deleteOldCookRecipeDetailsAndDishes(cookRecipeDTO);
// 重新创建详情+菜品数据
createRecipeDetails(cookRecipeDTO); createRecipeDetails(cookRecipeDTO);
return count; return count;
} catch (Exception e) { } catch (Exception e) {
@ -213,12 +241,13 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
if (!CollectionUtils.isEmpty(cookRecipeDTO.getRecipeDateList())) { if (!CollectionUtils.isEmpty(cookRecipeDTO.getRecipeDateList())) {
for (CookRecipeDateDTO recipeDateDTO : cookRecipeDTO.getRecipeDateList()) { for (CookRecipeDateDTO recipeDateDTO : cookRecipeDTO.getRecipeDateList()) {
List<CookRecipeDetailDTO> detailList = recipeDateDTO.getDetailList(); List<CookRecipeDetailDTO> detailList = recipeDateDTO.getDetailList();
for (CookRecipeDetailDTO detailDTO : detailList) { if (!CollectionUtils.isEmpty(detailList)) {
if (RecipeTypeEnum.POINT_DATE.key().equals(cookRecipeDTO.getRecipeType()) for (CookRecipeDetailDTO detailDTO : detailList) {
&& CollectionUtils.isEmpty(detailDTO.getDishesList())) { //指定日期不插入空数据 if (CollectionUtils.isEmpty(detailDTO.getDishesList())) { //不插入空数据
continue; continue;
}
insertDetailAndDishes(cookRecipeDTO, recipeDateDTO, detailDTO);
} }
insertDetailAndDishes(cookRecipeDTO, recipeDateDTO, detailDTO);
} }
} }
} }
@ -227,8 +256,13 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
if (!CollectionUtils.isEmpty(generatedRecipeDateList)) { if (!CollectionUtils.isEmpty(generatedRecipeDateList)) {
for (CookRecipeDateDTO recipeDateDTO : generatedRecipeDateList) { for (CookRecipeDateDTO recipeDateDTO : generatedRecipeDateList) {
List<CookRecipeDetailDTO> detailList = recipeDateDTO.getDetailList(); List<CookRecipeDetailDTO> detailList = recipeDateDTO.getDetailList();
for (CookRecipeDetailDTO detailDTO : detailList) { if (!CollectionUtils.isEmpty(detailList)) {
insertDetailAndDishes(cookRecipeDTO, recipeDateDTO, detailDTO); for (CookRecipeDetailDTO detailDTO : detailList) {
if (CollectionUtils.isEmpty(detailDTO.getDishesList())) { //不插入空数据
continue;
}
insertDetailAndDishes(cookRecipeDTO, recipeDateDTO, detailDTO);
}
} }
} }
} }
@ -242,7 +276,6 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
List<CookRecipeDateDTO> recipeDateListNew = new ArrayList<>(); List<CookRecipeDateDTO> recipeDateListNew = new ArrayList<>();
if (RecipeTypeEnum.DAILY.key().equals(cookRecipeDTO.getRecipeType()) && Objects.nonNull(recipeDateList.get(0))) { //每日循环 if (RecipeTypeEnum.DAILY.key().equals(cookRecipeDTO.getRecipeType()) && Objects.nonNull(recipeDateList.get(0))) { //每日循环
List<CookRecipeDetailDTO> recipeDetailList = recipeDateList.get(0).getDetailList(); List<CookRecipeDetailDTO> recipeDetailList = recipeDateList.get(0).getDetailList();
//新增详情
LocalDate now = LocalDate.now(); LocalDate now = LocalDate.now();
for (int i = 0; i < GlobalConstants.WEEK_DAYS; ++i) { for (int i = 0; i < GlobalConstants.WEEK_DAYS; ++i) {
CookRecipeDateDTO cookRecipeDateDTO = new CookRecipeDateDTO(); CookRecipeDateDTO cookRecipeDateDTO = new CookRecipeDateDTO();
@ -251,13 +284,7 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
recipeDateListNew.add(cookRecipeDateDTO); recipeDateListNew.add(cookRecipeDateDTO);
} }
} else if (RecipeTypeEnum.WEEKLY.key().equals(cookRecipeDTO.getRecipeType())) { //每周循环 } else if (RecipeTypeEnum.WEEKLY.key().equals(cookRecipeDTO.getRecipeType())) { //每周循环
LocalDate now = LocalDate.now(); HashMap<Integer, LocalDate> dateHashMap = DateUtil.getDaysInWeekMap();
HashMap<Integer, LocalDate> dateHashMap = new HashMap<>();
for (int i = 0; i < GlobalConstants.WEEK_DAYS; ++i) {
LocalDate applyWeek = now.plusDays((long) i);
dateHashMap.put(applyWeek.getDayOfWeek().getValue(), applyWeek);
}
//新增详情
Iterator<Map.Entry<Integer, LocalDate>> iterator = dateHashMap.entrySet().iterator(); Iterator<Map.Entry<Integer, LocalDate>> iterator = dateHashMap.entrySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
Map.Entry<Integer, LocalDate> entry = iterator.next(); Map.Entry<Integer, LocalDate> entry = iterator.next();
@ -305,49 +332,34 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
} }
} }
/** private void deleteOldCookRecipeDetailsAndDishes(CookRecipeDTO cookRecipeDTO) {
* 修改菜品计划信息 List<Long> cookRecipeDetailIds = new ArrayList<>();
* // 更新菜谱时指定日期菜谱删掉指定日期的菜谱
* @param cookRecipeDTO 菜品计划信息 if (RecipeTypeEnum.POINT_DATE.key().equals(cookRecipeDTO.getRecipeType())) {
* @return 结果 List<LocalDate> dateList = cookRecipeDTO.getRecipeDateList().stream().map(CookRecipeDateDTO::getApplyDate).collect(Collectors.toList());
*/ cookRecipeDetailIds = cookRecipeDetailMapper.getToDeleteCookRecipeDetailIds4PointDays(cookRecipeDTO.getRecipeId(), dateList);
@Override }
public int updateCookRecipe(CookRecipeDTO cookRecipeDTO) { // 循环日菜谱删掉模板数据 + 今日开始的详情数据
cookRecipeDTO.setUpdateTime(DateUtils.getNowDate()); if (RecipeTypeEnum.DAILY.key().equals(cookRecipeDTO.getRecipeType())) {
cookRecipeDTO.setUpdateBy(SecurityUtils.getUsername()); cookRecipeDetailIds = cookRecipeDetailMapper.getToDeleteCookRecipeDetailIds4Daily(cookRecipeDTO.getRecipeId());
try { }
List<CookRecipe> cookRecipes = cookRecipeMapper.selectCookRecipeList(new CookRecipe()); // 循环周菜谱删掉指定周x模板数据 + 今日开始的周x的详情数据
List<String> otherCookRecipes = cookRecipes.stream().filter(item -> !item.getRecipeId().equals(cookRecipeDTO.getRecipeId())) if (RecipeTypeEnum.WEEKLY.key().equals(cookRecipeDTO.getRecipeType())) {
.map(CookRecipe::getRecipeName).collect(Collectors.toList()); List<Long> applyWeeks = cookRecipeDTO.getRecipeDateList().stream().map(CookRecipeDateDTO::getApplyWeek).collect(Collectors.toList());
if (otherCookRecipes.contains(cookRecipeDTO.getRecipeName())) { HashMap<Integer, LocalDate> dateHashMap = DateUtil.getDaysInWeekMap();
throw new ServiceException("该菜谱名称已存在,请重新输入"); List<LocalDate> dateList = new ArrayList<>();
for (Long applyWeek : applyWeeks) {
dateList.add(dateHashMap.get(applyWeek.intValue()));
} }
int count = cookRecipeMapper.updateCookRecipe(cookRecipeDTO); //模板数据
List<Long> cookRecipeDetailIds = new ArrayList<>(); cookRecipeDetailIds.addAll(cookRecipeDetailMapper.getToDeleteCookRecipeDetailIds4WeeklyTemplate(cookRecipeDTO.getRecipeId(), applyWeeks));
// 更新菜谱时指定日期菜谱删掉指定日期的菜谱 //详情数据
if (RecipeTypeEnum.POINT_DATE.key().equals(cookRecipeDTO.getRecipeType())) { cookRecipeDetailIds.addAll(cookRecipeDetailMapper.getToDeleteCookRecipeDetailIds4WeeklyDetail(cookRecipeDTO.getRecipeId(), dateList));
List<LocalDate> dateList = cookRecipeDTO.getRecipeDateList().stream().map(CookRecipeDateDTO::getApplyDate).collect(Collectors.toList()); }
cookRecipeDetailIds = cookRecipeDetailMapper.getToDeleteCookRecipeDetailIds4PointDays(cookRecipeDTO.getRecipeId(), dateList); if (!CollectionUtils.isEmpty(cookRecipeDetailIds)) {
} Long[] cookRecipeDetailArray = cookRecipeDetailIds.stream().toArray(Long[]::new);
// 循环日菜谱删掉模板数据 + 今日开始的详情数据 cookRecipeDishesMapper.deleteCookRecipeDishesByCookRecipeDetailIds(cookRecipeDetailArray);
if (RecipeTypeEnum.DAILY.key().equals(cookRecipeDTO.getRecipeType())) { cookRecipeDetailMapper.deleteCookRecipeDetailByRecipeDetailIds(cookRecipeDetailArray);
cookRecipeDetailIds = cookRecipeDetailMapper.getToDeleteCookRecipeDetailIds4Daily(cookRecipeDTO.getRecipeId());
}
// 循环周菜谱删掉指定周x模板数据 + 今日开始的周x的详情数据
if (RecipeTypeEnum.WEEKLY.key().equals(cookRecipeDTO.getRecipeType())) {
List<Long> weekDayList = cookRecipeDTO.getRecipeDateList().stream().map(CookRecipeDateDTO::getApplyWeek).collect(Collectors.toList());
cookRecipeDetailIds = cookRecipeDetailMapper.getToDeleteCookRecipeDetailIds4Weekly(cookRecipeDTO.getRecipeId());
}
if (!CollectionUtils.isEmpty(cookRecipeDetailIds)) {
Long[] cookRecipeDetailArray = cookRecipeDetailIds.stream().toArray(Long[]::new);
cookRecipeDishesMapper.deleteCookRecipeDishesByCookRecipeDetailIds(cookRecipeDetailArray);
cookRecipeDetailMapper.deleteCookRecipeDetailByRecipeDetailIds(cookRecipeDetailArray);
}
// 重新创建菜谱
createRecipeDetails(cookRecipeDTO);
return count;
} catch (Exception e) {
throw new ServiceException(e.getMessage());
} }
} }

View File

@ -25,7 +25,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBasicAreaList" parameterType="com.bonus.canteen.core.basic.domain.BasicArea" resultMap="BasicAreaResult"> <select id="selectBasicAreaList" parameterType="com.bonus.canteen.core.basic.domain.BasicArea" resultMap="BasicAreaResult">
<include refid="selectBasicAreaVo"/> <include refid="selectBasicAreaVo"/>
<where> <where>
del_flag = '0'
<if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if> <if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
<if test="parentId != null "> and parent_id = #{parentId}</if> <if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="manager != null and manager != ''"> and manager = #{manager}</if> <if test="manager != null and manager != ''"> and manager = #{manager}</if>
@ -37,12 +38,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBasicAreaByAreaName" parameterType="String" resultMap="BasicAreaResult"> <select id="selectBasicAreaByAreaName" parameterType="String" resultMap="BasicAreaResult">
<include refid="selectBasicAreaVo"/> <include refid="selectBasicAreaVo"/>
where del_flag = 0 and area_name = #{areaName} where del_flag = '0' and area_name = #{areaName}
</select> </select>
<select id="selectBasicAreaByAreaId" parameterType="Long" resultMap="BasicAreaResult"> <select id="selectBasicAreaByAreaId" parameterType="Long" resultMap="BasicAreaResult">
<include refid="selectBasicAreaVo"/> <include refid="selectBasicAreaVo"/>
where del_flag = 0 and area_id = #{areaId} where del_flag = '0' and area_id = #{areaId}
</select> </select>
<insert id="insertBasicArea" parameterType="com.bonus.canteen.core.basic.domain.BasicArea" useGeneratedKeys="true" keyProperty="areaId"> <insert id="insertBasicArea" parameterType="com.bonus.canteen.core.basic.domain.BasicArea" useGeneratedKeys="true" keyProperty="areaId">

View File

@ -40,7 +40,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBasicCanteenList" parameterType="com.bonus.canteen.core.basic.domain.BasicCanteen" resultMap="BasicCanteenResult"> <select id="selectBasicCanteenList" parameterType="com.bonus.canteen.core.basic.domain.BasicCanteen" resultMap="BasicCanteenResult">
<include refid="selectBasicCanteenVo"/> <include refid="selectBasicCanteenVo"/>
<where> <where>
bc.del_flag = '0'
<if test="canteenName != null and canteenName != ''"> and bc.canteen_name like concat('%', #{canteenName}, '%')</if> <if test="canteenName != null and canteenName != ''"> and bc.canteen_name like concat('%', #{canteenName}, '%')</if>
<if test="areaId != null "> and bc.area_id = #{areaId}</if> <if test="areaId != null "> and bc.area_id = #{areaId}</if>
<if test="manager != null and manager != ''"> and bc.manager = #{manager}</if> <if test="manager != null and manager != ''"> and bc.manager = #{manager}</if>
@ -63,18 +64,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBasicCanteenByCanteenId" parameterType="Long" resultMap="BasicCanteenResult"> <select id="selectBasicCanteenByCanteenId" parameterType="Long" resultMap="BasicCanteenResult">
<include refid="selectBasicCanteenVo"/> <include refid="selectBasicCanteenVo"/>
where bc.canteen_id = #{canteenId} and bc.del_flag = 0 where bc.canteen_id = #{canteenId} and bc.del_flag = '0'
</select> </select>
<select id="selectBasicCanteenByCanteenName" parameterType="com.bonus.canteen.core.basic.domain.BasicCanteen" resultMap="BasicCanteenResult"> <select id="selectBasicCanteenByCanteenName" parameterType="com.bonus.canteen.core.basic.domain.BasicCanteen" resultMap="BasicCanteenResult">
<include refid="selectBasicCanteenVo"/> <include refid="selectBasicCanteenVo"/>
where bc.canteen_name = #{canteenName} and bc.area_id = #{areaId} and bc.del_flag = 0 where bc.canteen_name = #{canteenName} and bc.area_id = #{areaId} and bc.del_flag = '0'
</select> </select>
<select id="getBasicCanteenCountByAreaIds" resultType="Integer"> <select id="getBasicCanteenCountByAreaIds" resultType="Integer">
select count(1) select count(1)
from basic_canteen from basic_canteen
where del_flag = 0 and area_id in where del_flag = '0' and area_id in
<foreach item="areaId" collection="array" open="(" separator="," close=")"> <foreach item="areaId" collection="array" open="(" separator="," close=")">
#{areaId} #{areaId}
</foreach> </foreach>

View File

@ -42,7 +42,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBasicStallList" parameterType="com.bonus.canteen.core.basic.domain.BasicStall" resultMap="BasicStallResult"> <select id="selectBasicStallList" parameterType="com.bonus.canteen.core.basic.domain.BasicStall" resultMap="BasicStallResult">
<include refid="selectBasicStallVo"/> <include refid="selectBasicStallVo"/>
<where> <where>
bs.del_flag = '0'
<if test="stallName != null and stallName != ''"> and bs.stall_name like concat('%', #{stallName}, '%')</if> <if test="stallName != null and stallName != ''"> and bs.stall_name like concat('%', #{stallName}, '%')</if>
<if test="areaId != null "> and bs.area_id = #{areaId}</if> <if test="areaId != null "> and bs.area_id = #{areaId}</if>
<if test="canteenId != null "> and bs.canteen_id = #{canteenId}</if> <if test="canteenId != null "> and bs.canteen_id = #{canteenId}</if>
@ -65,12 +66,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBasicStallByStallId" parameterType="Long" resultMap="BasicStallResult"> <select id="selectBasicStallByStallId" parameterType="Long" resultMap="BasicStallResult">
<include refid="selectBasicStallVo"/> <include refid="selectBasicStallVo"/>
where bs.stall_id = #{stallId} and bs.del_flag = 0 where bs.stall_id = #{stallId} and bs.del_flag = '0'
</select> </select>
<select id="selectBasicStallByStallName" parameterType="com.bonus.canteen.core.basic.domain.BasicStall" resultMap="BasicStallResult"> <select id="selectBasicStallByStallName" parameterType="com.bonus.canteen.core.basic.domain.BasicStall" resultMap="BasicStallResult">
<include refid="selectBasicStallVo"/> <include refid="selectBasicStallVo"/>
where bs.stall_name = #{stallName} and bs.canteen_id = #{canteenId} and bs.del_flag = 0 where bs.stall_name = #{stallName} and bs.canteen_id = #{canteenId} and bs.del_flag = '0'
</select> </select>
<select id="selectBasicStallCountByCanteenIds" resultType="Integer"> <select id="selectBasicStallCountByCanteenIds" resultType="Integer">

View File

@ -131,18 +131,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where cr.recipe_id = #{recipeId} and cr.recipe_type = 2 and crd.detail_type = 2 and crd.apply_date >= NOW()-1 where cr.recipe_id = #{recipeId} and cr.recipe_type = 2 and crd.detail_type = 2 and crd.apply_date >= NOW()-1
</select> </select>
<select id="getToDeleteCookRecipeDetailIds4Weekly" parameterType="Long" resultType="Long"> <select id="getToDeleteCookRecipeDetailIds4WeeklyTemplate" parameterType="Long" resultType="Long">
SELECT distinct(crd.recipe_detail_id) SELECT distinct(crd.recipe_detail_id)
FROM cook_recipe_detail crd FROM cook_recipe_detail crd
left join cook_recipe cr ON cr.recipe_id = crd.recipe_id left join cook_recipe cr ON cr.recipe_id = crd.recipe_id
where cr.recipe_id = #{recipeId} and cr.recipe_type = 3 and crd.detail_type = 1 where cr.recipe_id = #{recipeId} and cr.recipe_type = 3 and crd.detail_type = 1 and crd.apply_week in
<foreach item="applyWeek" collection="applyWeeks" open="(" separator="," close=")">
UNION #{applyWeek}
</foreach>
</select>
<select id="getToDeleteCookRecipeDetailIds4WeeklyDetail" resultType="Long">
SELECT distinct(crd.recipe_detail_id) SELECT distinct(crd.recipe_detail_id)
FROM cook_recipe_detail crd FROM cook_recipe_detail crd
left join cook_recipe cr ON cr.recipe_id = crd.recipe_id left join cook_recipe cr ON cr.recipe_id = crd.recipe_id
where cr.recipe_id = #{recipeId} and cr.recipe_type = 3 and crd.detail_type = 2 and crd.apply_date >= NOW()-1 where cr.recipe_id = #{recipeId} and cr.recipe_type = 3 and crd.detail_type = 2 and crd.apply_date in
<foreach item="applyDate" collection="dateList" open="(" separator="," close=")">
#{applyDate}
</foreach>
</select> </select>
<select id="getCookRecipeDetailLTemplate" resultMap="CookRecipeDetailResult"> <select id="getCookRecipeDetailLTemplate" resultMap="CookRecipeDetailResult">

View File

@ -62,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectCookRecipeList" parameterType="com.bonus.canteen.core.cook.domain.CookRecipe" resultMap="CookRecipeResult"> <select id="selectCookRecipeList" parameterType="com.bonus.canteen.core.cook.domain.CookRecipe" resultMap="CookRecipeResult">
<include refid="selectCookRecipeVo"/> <include refid="selectCookRecipeVo"/>
<where> <where>
cr.del_flag = 0 ba.del_flag = '0' and bc.del_flag = '0' and bs.del_flag = '0' and cr.del_flag = '0'
<if test="recipeName != null and recipeName != ''"> and cr.recipe_name like concat('%', #{recipeName}, '%')</if> <if test="recipeName != null and recipeName != ''"> and cr.recipe_name like concat('%', #{recipeName}, '%')</if>
<if test="recipeType != null "> and cr.recipe_type = #{recipeType}</if> <if test="recipeType != null "> and cr.recipe_type = #{recipeType}</if>
<if test="stallId != null "> and cr.stall_id = #{stallId}</if> <if test="stallId != null "> and cr.stall_id = #{stallId}</if>
@ -79,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectCookRecipeVo"/> <include refid="selectCookRecipeVo"/>
<where> <where>
<if test="recipeIds !=null and recipeIds.size()>0"> <if test="recipeIds !=null and recipeIds.size()>0">
AND recipe_id in AND cr.recipe_id in
<foreach collection="recipeIds" open="(" close=")" item="item" separator=","> <foreach collection="recipeIds" open="(" close=")" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
@ -237,12 +237,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectCookRecipeByRecipeId" parameterType="Long" resultMap="CookRecipeResult"> <select id="selectCookRecipeByRecipeId" parameterType="Long" resultMap="CookRecipeResult">
<include refid="selectCookRecipeVo"/> <include refid="selectCookRecipeVo"/>
where cr.recipe_id = #{recipeId} and cr.del_flag = 0 where cr.recipe_id = #{recipeId} and ba.del_flag = '0' and bc.del_flag = '0' and bs.del_flag = '0' and cr.del_flag = '0'
</select> </select>
<select id="selectCookRecipeByRecipeName" parameterType="String" resultMap="CookRecipeResult"> <select id="selectCookRecipeByRecipeName" parameterType="String" resultMap="CookRecipeResult">
<include refid="selectCookRecipeVo"/> <include refid="selectCookRecipeVo"/>
where cr.recipe_name = #{recipeName} and cr.del_flag = 0 where cr.recipe_name = #{recipeName} and ba.del_flag = '0' and bc.del_flag = '0' and bs.del_flag = '0' and cr.del_flag = '0'
</select> </select>
<insert id="insertCookRecipe" parameterType="com.bonus.canteen.core.cook.domain.CookRecipe" useGeneratedKeys="true" keyProperty="recipeId"> <insert id="insertCookRecipe" parameterType="com.bonus.canteen.core.cook.domain.CookRecipe" useGeneratedKeys="true" keyProperty="recipeId">
@ -382,12 +382,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
basic_stall t1 basic_stall t1
LEFT JOIN basic_canteen t2 ON t1.canteen_id = t2.canteen_id LEFT JOIN basic_canteen t2 ON t1.canteen_id = t2.canteen_id
LEFT JOIN basic_area t3 ON t2.area_id = t3.area_id LEFT JOIN basic_area t3 ON t2.area_id = t3.area_id
where 1=1 where t1.del_flag = '0' and t2.del_flag = '0' and t3.del_flag = '0'
<if test="recipeName !=null and recipeName !=''"> <if test="recipeName !=null and recipeName !=''">
AND EXISTS ( AND EXISTS (
select null select null
from cook_recipe_bind_app t4 INNER JOIN cook_recipe t5 on t4.recipe_id = t5.recipe_id from cook_recipe_bind_app t4 INNER JOIN cook_recipe t5 on t4.recipe_id = t5.recipe_id
where t5.stall_id = t1.stall_id AND t4.bind_type = #{bindType} where t5.del_flag = '0' and t5.stall_id = t1.stall_id AND t4.bind_type = #{bindType}
and t5.recipe_name like #{recipeName} and t5.recipe_name like #{recipeName}
) )
</if> </if>
@ -420,14 +420,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectRecipeByStallIdsAndBindType" <select id="selectRecipeByStallIdsAndBindType"
resultType="com.bonus.canteen.core.cook.vo.StallAndRecipeBindVO"> resultType="com.bonus.canteen.core.cook.vo.StallAndRecipeBindVO">
select select
mar.recipe_id, crba.recipe_id,
mr.stall_id, cr.stall_id,
mar.bind_type crba.bind_type
from cook_recipe_bind_app mar from cook_recipe_bind_app crba
left join cook_recipe mr on mar.recipe_id = mr.recipe_id left join cook_recipe cr on crba.recipe_id = cr.recipe_id
where bind_type = #{bindType} where bind_type = #{bindType} and cr.del_flag = '0'
<if test="stallIds !=null and stallIds.size() > 0 "> <if test="stallIds !=null and stallIds.size() > 0 ">
and mr.stall_id IN and cr.stall_id IN
<foreach collection="stallIds" item="stallId" separator="," open="(" close=")"> <foreach collection="stallIds" item="stallId" separator="," open="(" close=")">
#{stallId} #{stallId}
</foreach> </foreach>