!208 查询上一个订单最后一天食谱计划改为成交时间排序

Merge pull request !208 from 德仔/xzj
This commit is contained in:
德仔
2021-04-15 18:28:11 +08:00
committed by Gitee
16 changed files with 246 additions and 71 deletions

View File

@ -111,4 +111,15 @@
order by id desc
</select>
<!-- 查询总数 -->
<select id="getNutritionQuestionCount" resultType="int">
select count(id) from sys_nutrition_question where del_flag = 0
</select>
<!-- 分页查询-->
<select id="getNutritionQuestionListByPage" resultMap="SysNutritionQuestionResult">
select * from sys_nutrition_question where del_flag = 0 order by id asc limit #{start},#{pageSize}
</select>
</mapper>

View File

@ -63,9 +63,11 @@
</select>
<!-- 根据用户ID查询是否存在该用户该订单之前的最后一条食谱 -->
<select id="getLastDayRecipesPlan" resultMap="SysRecipesPlanResult" parameterType="Long">
<include refid="selectSysRecipesPlanVo"/>
where cus_id = #{customerId} and del_flag = 0 and #{orderId} > order_id order by end_num_day DESC limit 1
<select id="getLastDayRecipesPlan" resultMap="SysRecipesPlanResult">
select srp.*
from sys_recipes_plan srp
left join sys_order so on so.order_id = srp.order_id and so.del_flag = 0
where srp.cus_id = #{customerId} and srp.del_flag = 0 and #{orderTime} > so.order_time order by srp.end_num_day DESC limit 1
</select>
<insert id="insertSysRecipesPlan" parameterType="SysRecipesPlan" useGeneratedKeys="true" keyProperty="id">