2025-04-03 15:06:05 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
<!DOCTYPE mapper
|
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
2025-04-05 19:12:26 +08:00
|
|
|
<mapper namespace="com.bonus.canteen.core.menu.mapper.MenuAppRecipeMapper">
|
|
|
|
|
<resultMap type="com.bonus.canteen.core.menu.domain.MenuAppRecipe" id="MenuAppRecipeResult">
|
2025-04-03 15:06:05 +08:00
|
|
|
<result property="id" column="id" />
|
|
|
|
|
<result property="recipeId" column="recipe_id" />
|
|
|
|
|
<result property="bindType" column="bind_type" />
|
|
|
|
|
<result property="bindTime" column="bind_time" />
|
|
|
|
|
<result property="mealLineId" column="meal_line_id" />
|
|
|
|
|
<result property="createBy" column="create_by" />
|
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
|
<result property="remark" column="remark" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
2025-04-17 13:09:10 +08:00
|
|
|
<resultMap id="appletReserveRecipeVO" type="com.bonus.canteen.core.menu.vo.AppletReserveRecipeVO">
|
|
|
|
|
<result property="mealtimeType" column="mealtime_type"/>
|
|
|
|
|
<collection property="typeList" ofType="com.bonus.canteen.core.menu.vo.AppletReserveRecipeTypeVO">
|
|
|
|
|
<result property="typeId" column="type_id"/>
|
|
|
|
|
<result property="typeName" column="type_name"/>
|
|
|
|
|
<collection property="dishesList" ofType="com.bonus.canteen.core.menu.vo.AppletReserveRecipeDishesVO">
|
|
|
|
|
<result property="baseDishesId" column="base_dishes_id"/>
|
|
|
|
|
<result property="dishesName" column="dishes_name"/>
|
|
|
|
|
<result property="detailType" column="detail_type"/>
|
|
|
|
|
<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"/>
|
|
|
|
|
<result property="recommendFlag" column="recommend_flag"/>
|
|
|
|
|
<collection property="dishesDetailList" ofType="com.bonus.canteen.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"/>
|
|
|
|
|
<result property="monthlySales" column="monthly_sales"/>
|
|
|
|
|
<result property="goodProbability" column="good_probability"/>
|
|
|
|
|
</collection>
|
|
|
|
|
<collection property="tasteNameList" ofType="string">
|
|
|
|
|
<result property="tasteName" column="taste_name"/>
|
|
|
|
|
</collection>
|
|
|
|
|
</collection>
|
|
|
|
|
</collection>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
2025-04-03 15:06:05 +08:00
|
|
|
<sql id="selectMenuAppRecipeVo">
|
|
|
|
|
select id, recipe_id, bind_type, bind_time, meal_line_id, create_by, create_time, update_by, update_time, remark from menu_app_recipe
|
|
|
|
|
</sql>
|
|
|
|
|
|
2025-04-05 19:12:26 +08:00
|
|
|
<select id="selectMenuAppRecipeList" parameterType="com.bonus.canteen.core.menu.domain.MenuAppRecipe" resultMap="MenuAppRecipeResult">
|
2025-04-03 15:06:05 +08:00
|
|
|
<include refid="selectMenuAppRecipeVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="recipeId != null "> and recipe_id = #{recipeId}</if>
|
|
|
|
|
<if test="bindType != null "> and bind_type = #{bindType}</if>
|
|
|
|
|
<if test="bindTime != null "> and bind_time = #{bindTime}</if>
|
|
|
|
|
<if test="mealLineId != null "> and meal_line_id = #{mealLineId}</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectMenuAppRecipeById" parameterType="Long" resultMap="MenuAppRecipeResult">
|
|
|
|
|
<include refid="selectMenuAppRecipeVo"/>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
2025-04-05 19:12:26 +08:00
|
|
|
<insert id="insertMenuAppRecipe" parameterType="com.bonus.canteen.core.menu.domain.MenuAppRecipe" useGeneratedKeys="true" keyProperty="id">
|
2025-04-03 15:06:05 +08:00
|
|
|
insert into menu_app_recipe
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="recipeId != null">recipe_id,</if>
|
|
|
|
|
<if test="bindType != null">bind_type,</if>
|
|
|
|
|
<if test="bindTime != null">bind_time,</if>
|
|
|
|
|
<if test="mealLineId != null">meal_line_id,</if>
|
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
|
<if test="remark != null">remark,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="recipeId != null">#{recipeId},</if>
|
|
|
|
|
<if test="bindType != null">#{bindType},</if>
|
|
|
|
|
<if test="bindTime != null">#{bindTime},</if>
|
|
|
|
|
<if test="mealLineId != null">#{mealLineId},</if>
|
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
<if test="remark != null">#{remark},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
2025-04-05 19:12:26 +08:00
|
|
|
<update id="updateMenuAppRecipe" parameterType="com.bonus.canteen.core.menu.domain.MenuAppRecipe">
|
2025-04-03 15:06:05 +08:00
|
|
|
update menu_app_recipe
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="recipeId != null">recipe_id = #{recipeId},</if>
|
|
|
|
|
<if test="bindType != null">bind_type = #{bindType},</if>
|
|
|
|
|
<if test="bindTime != null">bind_time = #{bindTime},</if>
|
|
|
|
|
<if test="mealLineId != null">meal_line_id = #{mealLineId},</if>
|
|
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteMenuAppRecipeById" parameterType="Long">
|
|
|
|
|
delete from menu_app_recipe where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteMenuAppRecipeByIds" parameterType="String">
|
|
|
|
|
delete from menu_app_recipe where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
2025-04-17 10:53:45 +08:00
|
|
|
|
|
|
|
|
<!-- 获取预定点餐菜谱 -->
|
2025-04-17 13:09:10 +08:00
|
|
|
<select id="selectReserveRecipe" resultMap="appletReserveRecipeVO">
|
2025-04-17 10:53:45 +08:00
|
|
|
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.meal_type as detail_type,
|
|
|
|
|
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,
|
|
|
|
|
m.recommend_flag,
|
|
|
|
|
md.size_json,
|
|
|
|
|
mdsr.monthly_sales,
|
|
|
|
|
mdsr.good_probability
|
|
|
|
|
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
|
|
|
|
|
inner join menu_app_recipe mar on mr.recipe_id = mar.recipe_id
|
|
|
|
|
and mar.bind_type = 2
|
|
|
|
|
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}
|
|
|
|
|
and mr.recipe_id = #{recipeId}
|
|
|
|
|
order by
|
|
|
|
|
m.sort_num asc
|
|
|
|
|
</select>
|
2025-04-03 15:06:05 +08:00
|
|
|
</mapper>
|