Merge branch 'master' into order
This commit is contained in:
commit
92681d878f
|
|
@ -1,9 +1,12 @@
|
|||
package com.bonus.canteen.core.common.utils;
|
||||
|
||||
import com.bonus.common.houqin.constant.GlobalConstants;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class DateUtil {
|
||||
|
|
@ -27,4 +30,14 @@ public class DateUtil {
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.canteen.core.cook.mapper;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import com.bonus.canteen.core.cook.domain.CookRecipeDetail;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -61,7 +62,15 @@ public interface CookRecipeDetailMapper {
|
|||
|
||||
public List<Long> getAllCookRecipeDetailIds(Long[] recipeIds);
|
||||
|
||||
public List<Long> getToDeleteCookRecipeDetailIds(Long recipeId);
|
||||
|
||||
public List<Long> getToDeleteCookRecipeDetailIds4PointDays(@Param("recipeId") Long recipeId, @Param("dateList") List<LocalDate> dateList);
|
||||
|
||||
public List<Long> getToDeleteCookRecipeDetailIds4Daily(@Param("recipeId") 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);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,35 +201,53 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
|||
throw new ServiceException("该菜谱名称已存在,请重新输入");
|
||||
}
|
||||
int count = cookRecipeMapper.insertCookRecipe(cookRecipeDTO); //插入菜谱
|
||||
createRecipeDetails(cookRecipeDTO, true);
|
||||
createRecipeDetails(cookRecipeDTO); //创建详情+菜品数据
|
||||
return count;
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void createRecipeDetails(CookRecipeDTO cookRecipeDTO, boolean isCreate) {
|
||||
// 更新菜谱时,
|
||||
// 指定日期菜谱,删掉指定日期的菜谱
|
||||
// 循环菜谱,删掉模板数据 + 今日开始的详情数据
|
||||
if (!isCreate) {
|
||||
List<Long> cookRecipeDetailIds = cookRecipeDetailMapper.getToDeleteCookRecipeDetailIds(cookRecipeDTO.getRecipeId());
|
||||
if (!CollectionUtils.isEmpty(cookRecipeDetailIds)) {
|
||||
Long[] cookRecipeDetailArray = cookRecipeDetailIds.stream().toArray(Long[]::new);
|
||||
cookRecipeDishesMapper.deleteCookRecipeDishesByCookRecipeDetailIds(cookRecipeDetailArray);
|
||||
cookRecipeDetailMapper.deleteCookRecipeDetailByRecipeDetailIds(cookRecipeDetailArray);
|
||||
/**
|
||||
* 修改菜品计划信息
|
||||
*
|
||||
* @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);
|
||||
return count;
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void createRecipeDetails(CookRecipeDTO cookRecipeDTO) {
|
||||
// 插入指定日期、日循环摸板、周循环模板
|
||||
if (!CollectionUtils.isEmpty(cookRecipeDTO.getRecipeDateList())) {
|
||||
for (CookRecipeDateDTO recipeDateDTO : cookRecipeDTO.getRecipeDateList()) {
|
||||
List<CookRecipeDetailDTO> detailList = recipeDateDTO.getDetailList();
|
||||
for (CookRecipeDetailDTO detailDTO : detailList) {
|
||||
if (RecipeTypeEnum.POINT_DATE.key().equals(cookRecipeDTO.getRecipeType())
|
||||
&& CollectionUtils.isEmpty(detailDTO.getDishesList())) { //指定日期,不插入空数据
|
||||
continue;
|
||||
if (!CollectionUtils.isEmpty(detailList)) {
|
||||
for (CookRecipeDetailDTO detailDTO : detailList) {
|
||||
if (CollectionUtils.isEmpty(detailDTO.getDishesList())) { //不插入空数据
|
||||
continue;
|
||||
}
|
||||
insertDetailAndDishes(cookRecipeDTO, recipeDateDTO, detailDTO);
|
||||
}
|
||||
insertDetailAndDishes(cookRecipeDTO, recipeDateDTO, detailDTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -238,8 +256,13 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
|||
if (!CollectionUtils.isEmpty(generatedRecipeDateList)) {
|
||||
for (CookRecipeDateDTO recipeDateDTO : generatedRecipeDateList) {
|
||||
List<CookRecipeDetailDTO> detailList = recipeDateDTO.getDetailList();
|
||||
for (CookRecipeDetailDTO detailDTO : detailList) {
|
||||
insertDetailAndDishes(cookRecipeDTO, recipeDateDTO, detailDTO);
|
||||
if (!CollectionUtils.isEmpty(detailList)) {
|
||||
for (CookRecipeDetailDTO detailDTO : detailList) {
|
||||
if (CollectionUtils.isEmpty(detailDTO.getDishesList())) { //不插入空数据
|
||||
continue;
|
||||
}
|
||||
insertDetailAndDishes(cookRecipeDTO, recipeDateDTO, detailDTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -253,7 +276,6 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
|||
List<CookRecipeDateDTO> recipeDateListNew = new ArrayList<>();
|
||||
if (RecipeTypeEnum.DAILY.key().equals(cookRecipeDTO.getRecipeType()) && Objects.nonNull(recipeDateList.get(0))) { //每日循环
|
||||
List<CookRecipeDetailDTO> recipeDetailList = recipeDateList.get(0).getDetailList();
|
||||
//新增详情
|
||||
LocalDate now = LocalDate.now();
|
||||
for (int i = 0; i < GlobalConstants.WEEK_DAYS; ++i) {
|
||||
CookRecipeDateDTO cookRecipeDateDTO = new CookRecipeDateDTO();
|
||||
|
|
@ -262,13 +284,7 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
|||
recipeDateListNew.add(cookRecipeDateDTO);
|
||||
}
|
||||
} else if (RecipeTypeEnum.WEEKLY.key().equals(cookRecipeDTO.getRecipeType())) { //每周循环
|
||||
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);
|
||||
}
|
||||
//新增详情
|
||||
HashMap<Integer, LocalDate> dateHashMap = DateUtil.getDaysInWeekMap();
|
||||
Iterator<Map.Entry<Integer, LocalDate>> iterator = dateHashMap.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<Integer, LocalDate> entry = iterator.next();
|
||||
|
|
@ -316,28 +332,34 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜品计划信息
|
||||
*
|
||||
* @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("该菜谱名称已存在,请重新输入");
|
||||
private void deleteOldCookRecipeDetailsAndDishes(CookRecipeDTO cookRecipeDTO) {
|
||||
List<Long> cookRecipeDetailIds = new ArrayList<>();
|
||||
// 更新菜谱时,指定日期菜谱,删掉指定日期的菜谱
|
||||
if (RecipeTypeEnum.POINT_DATE.key().equals(cookRecipeDTO.getRecipeType())) {
|
||||
List<LocalDate> dateList = cookRecipeDTO.getRecipeDateList().stream().map(CookRecipeDateDTO::getApplyDate).collect(Collectors.toList());
|
||||
cookRecipeDetailIds = cookRecipeDetailMapper.getToDeleteCookRecipeDetailIds4PointDays(cookRecipeDTO.getRecipeId(), dateList);
|
||||
}
|
||||
// 循环日菜谱,删掉模板数据 + 今日开始的详情数据
|
||||
if (RecipeTypeEnum.DAILY.key().equals(cookRecipeDTO.getRecipeType())) {
|
||||
cookRecipeDetailIds = cookRecipeDetailMapper.getToDeleteCookRecipeDetailIds4Daily(cookRecipeDTO.getRecipeId());
|
||||
}
|
||||
// 循环周菜谱,删掉指定周x模板数据 + 今日开始的周x的详情数据
|
||||
if (RecipeTypeEnum.WEEKLY.key().equals(cookRecipeDTO.getRecipeType())) {
|
||||
List<Long> applyWeeks = cookRecipeDTO.getRecipeDateList().stream().map(CookRecipeDateDTO::getApplyWeek).collect(Collectors.toList());
|
||||
HashMap<Integer, LocalDate> dateHashMap = DateUtil.getDaysInWeekMap();
|
||||
List<LocalDate> dateList = new ArrayList<>();
|
||||
for (Long applyWeek : applyWeeks) {
|
||||
dateList.add(dateHashMap.get(applyWeek.intValue()));
|
||||
}
|
||||
int count = cookRecipeMapper.updateCookRecipe(cookRecipeDTO);
|
||||
createRecipeDetails(cookRecipeDTO, false);
|
||||
return count;
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
//模板数据
|
||||
cookRecipeDetailIds.addAll(cookRecipeDetailMapper.getToDeleteCookRecipeDetailIds4WeeklyTemplate(cookRecipeDTO.getRecipeId(), applyWeeks));
|
||||
//详情数据
|
||||
cookRecipeDetailIds.addAll(cookRecipeDetailMapper.getToDeleteCookRecipeDetailIds4WeeklyDetail(cookRecipeDTO.getRecipeId(), dateList));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(cookRecipeDetailIds)) {
|
||||
Long[] cookRecipeDetailArray = cookRecipeDetailIds.stream().toArray(Long[]::new);
|
||||
cookRecipeDishesMapper.deleteCookRecipeDishesByCookRecipeDetailIds(cookRecipeDetailArray);
|
||||
cookRecipeDetailMapper.deleteCookRecipeDetailByRecipeDetailIds(cookRecipeDetailArray);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
<include refid="selectBasicAreaVo"/>
|
||||
<where>
|
||||
<where>
|
||||
del_flag = '0'
|
||||
<if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
|
||||
<if test="parentId != null "> and parent_id = #{parentId}</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">
|
||||
<include refid="selectBasicAreaVo"/>
|
||||
where del_flag = 0 and area_name = #{areaName}
|
||||
where del_flag = '0' and area_name = #{areaName}
|
||||
</select>
|
||||
|
||||
<select id="selectBasicAreaByAreaId" parameterType="Long" resultMap="BasicAreaResult">
|
||||
<include refid="selectBasicAreaVo"/>
|
||||
where del_flag = 0 and area_id = #{areaId}
|
||||
where del_flag = '0' and area_id = #{areaId}
|
||||
</select>
|
||||
|
||||
<insert id="insertBasicArea" parameterType="com.bonus.canteen.core.basic.domain.BasicArea" useGeneratedKeys="true" keyProperty="areaId">
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
<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="areaId != null "> and bc.area_id = #{areaId}</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">
|
||||
<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 id="selectBasicCanteenByCanteenName" parameterType="com.bonus.canteen.core.basic.domain.BasicCanteen" resultMap="BasicCanteenResult">
|
||||
<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 id="getBasicCanteenCountByAreaIds" resultType="Integer">
|
||||
select count(1)
|
||||
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=")">
|
||||
#{areaId}
|
||||
</foreach>
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
<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="areaId != null "> and bs.area_id = #{areaId}</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">
|
||||
<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 id="selectBasicStallByStallName" parameterType="com.bonus.canteen.core.basic.domain.BasicStall" resultMap="BasicStallResult">
|
||||
<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 id="selectBasicStallCountByCanteenIds" resultType="Integer">
|
||||
|
|
|
|||
|
|
@ -107,14 +107,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getToDeleteCookRecipeDetailIds" parameterType="Long" resultType="Long">
|
||||
<select id="getToDeleteCookRecipeDetailIds4PointDays" resultType="Long">
|
||||
SELECT distinct(crd.recipe_detail_id)
|
||||
FROM cook_recipe_detail crd
|
||||
left join cook_recipe cr ON cr.recipe_id = crd.recipe_id
|
||||
where cr.recipe_id = #{recipeId} and cr.recipe_type = 1 and crd.apply_date >= NOW()-1
|
||||
|
||||
UNION
|
||||
left join cook_recipe cr ON cr.recipe_id = crd.recipe_id
|
||||
where cr.recipe_id = #{recipeId} and cr.recipe_type = 1 and crd.apply_date in
|
||||
<foreach item="applyDate" collection="dateList" open="(" separator="," close=")">
|
||||
#{applyDate}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getToDeleteCookRecipeDetailIds4Daily" resultType="Long">
|
||||
SELECT distinct(crd.recipe_detail_id)
|
||||
FROM cook_recipe_detail crd
|
||||
left join cook_recipe cr ON cr.recipe_id = crd.recipe_id
|
||||
|
|
@ -126,20 +129,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
FROM cook_recipe_detail crd
|
||||
left join cook_recipe cr ON cr.recipe_id = crd.recipe_id
|
||||
where cr.recipe_id = #{recipeId} and cr.recipe_type = 2 and crd.detail_type = 2 and crd.apply_date >= NOW()-1
|
||||
</select>
|
||||
|
||||
UNION
|
||||
|
||||
<select id="getToDeleteCookRecipeDetailIds4WeeklyTemplate" parameterType="Long" resultType="Long">
|
||||
SELECT distinct(crd.recipe_detail_id)
|
||||
FROM cook_recipe_detail crd
|
||||
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
|
||||
|
||||
UNION
|
||||
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=")">
|
||||
#{applyWeek}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getToDeleteCookRecipeDetailIds4WeeklyDetail" resultType="Long">
|
||||
SELECT distinct(crd.recipe_detail_id)
|
||||
FROM cook_recipe_detail crd
|
||||
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 id="getCookRecipeDetailLTemplate" resultMap="CookRecipeDetailResult">
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="salePrice != null">sale_price,</if>
|
||||
<if test="sizeType != null">size_type,</if>
|
||||
<if test="supplyNum != null">supply_num,</if>
|
||||
<if test="saleNum != null">sale_num,</if>
|
||||
<!--<if test="saleNum != null">sale_num,</if>-->
|
||||
<if test="remanentNum != null">remanent_num,</if>
|
||||
<if test="limitNum != null">limit_num,</if>
|
||||
<if test="chefId != null">chef_id,</if>
|
||||
|
|
@ -74,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="salePrice != null">#{salePrice},</if>
|
||||
<if test="sizeType != null">#{sizeType},</if>
|
||||
<if test="supplyNum != null">#{supplyNum},</if>
|
||||
<if test="saleNum != null">#{saleNum},</if>
|
||||
<!--<if test="saleNum != null">#{saleNum},</if>-->
|
||||
<if test="remanentNum != null">#{remanentNum},</if>
|
||||
<if test="limitNum != null">#{limitNum},</if>
|
||||
<if test="chefId != null">#{chefId},</if>
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectCookRecipeList" parameterType="com.bonus.canteen.core.cook.domain.CookRecipe" resultMap="CookRecipeResult">
|
||||
<include refid="selectCookRecipeVo"/>
|
||||
<where>
|
||||
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="recipeType != null "> and cr.recipe_type = #{recipeType}</if>
|
||||
<if test="stallId != null "> and cr.stall_id = #{stallId}</if>
|
||||
|
|
@ -78,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectCookRecipeVo"/>
|
||||
<where>
|
||||
<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=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
|
@ -236,12 +237,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectCookRecipeByRecipeId" parameterType="Long" resultMap="CookRecipeResult">
|
||||
<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 id="selectCookRecipeByRecipeName" parameterType="String" resultMap="CookRecipeResult">
|
||||
<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>
|
||||
|
||||
<insert id="insertCookRecipe" parameterType="com.bonus.canteen.core.cook.domain.CookRecipe" useGeneratedKeys="true" keyProperty="recipeId">
|
||||
|
|
@ -381,12 +382,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
basic_stall t1
|
||||
LEFT JOIN basic_canteen t2 ON t1.canteen_id = t2.canteen_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 !=''">
|
||||
AND EXISTS (
|
||||
select null
|
||||
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}
|
||||
)
|
||||
</if>
|
||||
|
|
@ -419,14 +420,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectRecipeByStallIdsAndBindType"
|
||||
resultType="com.bonus.canteen.core.cook.vo.StallAndRecipeBindVO">
|
||||
select
|
||||
mar.recipe_id,
|
||||
mr.stall_id,
|
||||
mar.bind_type
|
||||
from cook_recipe_bind_app mar
|
||||
left join cook_recipe mr on mar.recipe_id = mr.recipe_id
|
||||
where bind_type = #{bindType}
|
||||
crba.recipe_id,
|
||||
cr.stall_id,
|
||||
crba.bind_type
|
||||
from cook_recipe_bind_app crba
|
||||
left join cook_recipe cr on crba.recipe_id = cr.recipe_id
|
||||
where bind_type = #{bindType} and cr.del_flag = '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=")">
|
||||
#{stallId}
|
||||
</foreach>
|
||||
|
|
|
|||
Loading…
Reference in New Issue