食谱计划修改

This commit is contained in:
xiezhijun
2021-02-27 19:22:25 +08:00
parent a244a4a536
commit 2ceefcf9a5
7 changed files with 121 additions and 29 deletions

View File

@ -52,6 +52,8 @@
<if test="sendFlag != null ">and send_flag = #{sendFlag}</if>
<if test="sendTime != null ">and send_time = #{sendTime}</if>
<if test="reviewStatus != null ">and review_status = #{reviewStatus}</if>
<!-- 请勿轻易修改排序方式,会影响食谱生成等逻辑 -->
order by id ASC
</select>
<select id="selectSysRecipesPlanById" parameterType="Long" resultMap="SysRecipesPlanResult">
@ -59,11 +61,18 @@
where id = #{id} and del_flag = 0
</select>
<!-- 根据用户ID查询是否存在该用户最后一天食谱 -->
<select id="getLastDayRecipesPlan" resultMap="SysRecipesPlanResult" parameterType="Long">
<include refid="selectSysRecipesPlanVo"/>
where cus_id = #{customerId} and del_flag = 0 order by end_num_day DESC limit 1
</select>
<insert id="insertSysRecipesPlan" parameterType="SysRecipesPlan" useGeneratedKeys="true" keyProperty="id">
insert into sys_recipes_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderId != null">order_id,</if>
<if test="cusId != null">cus_id,</if>
<if test="outId != null">out_id,</if>
<if test="startDate != null">start_date,</if>
<if test="endDate != null">end_date,</if>
<if test="startNumDay != null">start_num_day,</if>
@ -81,6 +90,7 @@
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">#{orderId},</if>
<if test="cusId != null">#{cusId},</if>
<if test="outId != null">#{outId},</if>
<if test="startDate != null">#{startDate},</if>
<if test="endDate != null">#{endDate},</if>
<if test="startNumDay != null">#{startNumDay},</if>
@ -102,6 +112,7 @@
<trim prefix="SET" suffixOverrides=",">
<if test="orderId != null">order_id = #{orderId},</if>
<if test="cusId != null">cus_id = #{cusId},</if>
<if test="outId != null">out_id = #{outId},</if>
<if test="startDate != null">start_date = #{startDate},</if>
<if test="endDate != null">end_date = #{endDate},</if>
<if test="startNumDay != null">start_num_day = #{startNumDay},</if>
@ -133,10 +144,10 @@
<!-- 批量插入食谱计划 -->
<insert id="insertBatch">
INSERT INTO sys_recipes_plan
(order_id, cus_id, start_date, end_date, start_num_day, end_num_day, send_flag, send_time, recipes_id)
(order_id, cus_id, out_id, start_date, end_date, start_num_day, end_num_day, send_flag, send_time, recipes_id)
VALUES
<foreach collection="list" item="plan" separator=",">
(#{plan.orderId}, #{plan.cusId}, #{plan.startDate}, #{plan.endDate}, #{plan.startNumDay}, #{plan.endNumDay},
(#{plan.orderId}, #{plan.cusId}, #{plan.outId}, #{plan.startDate}, #{plan.endDate}, #{plan.startNumDay}, #{plan.endNumDay},
#{plan.sendFlag}, #{plan.sendTime}, #{plan.recipesId})
</foreach>
</insert>
@ -234,4 +245,12 @@
<select id="selectMenuIds" parameterType="Long" resultMap="SysRecipesResult">
select id, num_day from sys_customer_daily_menu where recipes_id=#{recipes_id} order by num_day asc
</select>
<!-- 批量修改食谱计划 -->
<update id="updateMuchRecipesPlanDate" parameterType="SysRecipesPlan"> 
<!--<foreach collection="list" item="item" separator=";" open="" close="">
</foreach>-->
update sys_recipes_plan set start_date = #{startDate},end_date = #{endDate} where id = #{id}
</update>
</mapper>