一周菜谱
This commit is contained in:
parent
2fe6bff85e
commit
2a1611f689
|
|
@ -1,9 +1,11 @@
|
||||||
package com.bonus.core.menu.mapper;
|
package com.bonus.core.menu.mapper;
|
||||||
|
|
||||||
import com.bonus.core.marketing.vo.MktEffectiveUserVO;
|
import com.bonus.core.marketing.vo.MktEffectiveUserVO;
|
||||||
|
import com.bonus.core.menu.vo.AppletWeekRecipeVO;
|
||||||
import com.bonus.domain.CustInfo;
|
import com.bonus.domain.CustInfo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
|
|
@ -12,4 +14,6 @@ public interface MenuRecipeMapper {
|
||||||
CustInfo selectOrgAndPsnByCustLimitId(CustInfo custInfo);
|
CustInfo selectOrgAndPsnByCustLimitId(CustInfo custInfo);
|
||||||
List<MktEffectiveUserVO> selectAllUserEff(@Param("effType") Integer effType, @Param("delFlag") Integer delFlag);
|
List<MktEffectiveUserVO> selectAllUserEff(@Param("effType") Integer effType, @Param("delFlag") Integer delFlag);
|
||||||
|
|
||||||
|
List<AppletWeekRecipeVO> selectWeekRecipe(@Param("applyDate") LocalDate applyDate, @Param("recipeId") Long recipeId, @Param("recipeIdList") List<Long> recipeIdList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,8 @@ public class MenuRecipeServiceImpl implements MenuRecipeService {
|
||||||
((List)recipeIdList).add(content.getRecipeId());
|
((List)recipeIdList).add(content.getRecipeId());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.generateRecipe((List)recipeIdList, content.getApplyDate());
|
//this.generateRecipe((List)recipeIdList, content.getApplyDate());
|
||||||
List<AppletWeekRecipeVO> resultList = ((MenuRecipeMapper)this.baseMapper).selectWeekRecipe(content.getApplyDate(), content.getRecipeId(), (List)recipeIdList);
|
List<AppletWeekRecipeVO> resultList = menuRecipeMapper.selectWeekRecipe(content.getApplyDate(), content.getRecipeId(), (List)recipeIdList);
|
||||||
resultList.sort(Collections.reverseOrder((s1, s2) -> {
|
resultList.sort(Collections.reverseOrder((s1, s2) -> {
|
||||||
return s2.getMealtimeType() - s1.getMealtimeType();
|
return s2.getMealtimeType() - s1.getMealtimeType();
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,34 @@
|
||||||
</collection>
|
</collection>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="appletWeekRecipeVO" type="com.bonus.core.menu.vo.AppletWeekRecipeVO">
|
||||||
|
<result property="mealtimeType" column="mealtime_type"/>
|
||||||
|
<collection property="typeList" ofType="com.bonus.core.menu.vo.AppletWeekRecipeTypeVO">
|
||||||
|
<result property="typeId" column="type_id"/>
|
||||||
|
<result property="typeName" column="type_name"/>
|
||||||
|
<collection property="dishesList" ofType="com.bonus.core.menu.vo.AppletWeekRecipeDishesVO">
|
||||||
|
<result property="baseDishesId" column="base_dishes_id"/>
|
||||||
|
<result property="dishesName" column="dishes_name"/>
|
||||||
|
<result property="dishesImgUrl" column="dishes_img_url"/>
|
||||||
|
<result property="detailId" column="detail_id"/>
|
||||||
|
<result property="canteenId" column="canteen_id"/>
|
||||||
|
<result property="canteenName" column="canteen_name"/>
|
||||||
|
<result property="stallId" column="stall_id"/>
|
||||||
|
<result property="stallName" column="stall_name"/>
|
||||||
|
<collection property="dishesDetailList" ofType="com.bonus.core.menu.vo.AppletCurrentDishesDetailVO">
|
||||||
|
<result property="dishesId" column="dishes_id"/>
|
||||||
|
<result property="dishesName" column="real_dishes_name"/>
|
||||||
|
<result property="surplusNum" column="surplus_num"/>
|
||||||
|
<result property="restrictNum" column="restrict_num"/>
|
||||||
|
<result property="dishesPrice" column="dishes_price"/>
|
||||||
|
<result property="prefPrice" column="pref_price"/>
|
||||||
|
<result property="sizeType" column="size_type"/>
|
||||||
|
<result property="sizeJson" column="size_json"/>
|
||||||
|
</collection>
|
||||||
|
</collection>
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<select id="selectOrgAndPsnByCustLimitId" parameterType="com.bonus.domain.CustInfo" resultType="com.bonus.domain.CustInfo">
|
<select id="selectOrgAndPsnByCustLimitId" parameterType="com.bonus.domain.CustInfo" resultType="com.bonus.domain.CustInfo">
|
||||||
select org_id, psn_type
|
select org_id, psn_type
|
||||||
from cust_info
|
from cust_info
|
||||||
|
|
@ -34,4 +62,53 @@
|
||||||
and me.del_flag = #{delFlag}
|
and me.del_flag = #{delFlag}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 获取一周菜谱 -->
|
||||||
|
<select id="selectWeekRecipe" resultMap="appletWeekRecipeVO">
|
||||||
|
select
|
||||||
|
mrd.mealtime_type,
|
||||||
|
if(md.meal_type = 2, 2, mdt.type_id) as type_id,
|
||||||
|
if(md.meal_type = 2, '套餐', mdt.type_name) as type_name,
|
||||||
|
mdb.base_dishes_id,
|
||||||
|
md.dishes_id,
|
||||||
|
mdb.dishes_name,
|
||||||
|
md.dishes_name as real_dishes_name,
|
||||||
|
md.image_url as dishes_img_url,
|
||||||
|
mrd.detail_id,
|
||||||
|
m.surplus_num,
|
||||||
|
m.restrict_num,
|
||||||
|
m.price as dishes_price,
|
||||||
|
m.sale_price as pref_price,
|
||||||
|
ac.canteen_id,
|
||||||
|
ac.canteen_name,
|
||||||
|
ass.stall_id,
|
||||||
|
ass.stall_name,
|
||||||
|
m.size_type,
|
||||||
|
md.size_json
|
||||||
|
from
|
||||||
|
menu_recipe_detail mrd
|
||||||
|
inner join menu_recipe_dishes m on mrd.detail_id = m.detail_id
|
||||||
|
inner join menu_dishes md on m.dishes_id = md.dishes_id
|
||||||
|
inner join menu_dishes_type mdt on md.type_id = mdt.type_id
|
||||||
|
inner join menu_recipe mr on mrd.recipe_id = mr.recipe_id
|
||||||
|
left join menu_dishes_sale_record mdsr on md.dishes_id = mdsr.dishes_id
|
||||||
|
and mr.stall_id = mdsr.stall_id
|
||||||
|
and mdsr.sale_month = month(curdate())
|
||||||
|
left join alloc_canteen ac on mr.canteen_id = ac.canteen_id
|
||||||
|
left join alloc_stall ass on mr.stall_id = ass.stall_id
|
||||||
|
left join menu_dishes_base mdb on md.base_dishes_id = mdb.base_dishes_id
|
||||||
|
where
|
||||||
|
mrd.apply_date = #{applyDate}
|
||||||
|
<if test="recipeId != null">
|
||||||
|
and mrd.recipe_id = #{recipeId}
|
||||||
|
</if>
|
||||||
|
<if test="recipeIdList != null and recipeIdList.size() > 0">
|
||||||
|
and mrd.recipe_id in
|
||||||
|
<foreach collection="recipeIdList" item="recipeId" open="(" separator="," close=")">
|
||||||
|
#{recipeId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
order by
|
||||||
|
m.sort_num asc
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Reference in New Issue