查询上一个订单最后一天食谱计划改为成交时间排序
This commit is contained in:
		| @@ -1,10 +1,13 @@ | ||||
| package com.stdiet.custom.mapper; | ||||
|  | ||||
| import java.util.Date; | ||||
| import java.util.List; | ||||
| import com.stdiet.custom.domain.SysRecipesPlan; | ||||
| import com.stdiet.custom.domain.SysRecipesPlanListInfo; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| import javax.xml.crypto.Data; | ||||
|  | ||||
| /** | ||||
|  * 食谱计划Mapper接口 | ||||
|  * | ||||
| @@ -87,7 +90,7 @@ public interface SysRecipesPlanMapper | ||||
|      * @param customerId | ||||
|      * @return | ||||
|      */ | ||||
|     SysRecipesPlan getLastDayRecipesPlan(@Param("customerId")Long customerId, @Param("orderId")Long orderId); | ||||
|     SysRecipesPlan getLastDayRecipesPlan(@Param("customerId")Long customerId, @Param("orderTime") Date orderTime); | ||||
|  | ||||
|     /** | ||||
|      * 根据订单ID查询食谱计划 | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| package com.stdiet.custom.service; | ||||
|  | ||||
| import java.util.Date; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.stdiet.custom.domain.SysRecipesPlan; | ||||
| @@ -102,7 +103,7 @@ public interface ISysRecipesPlanService | ||||
|      * @param customerId | ||||
|      * @return | ||||
|      */ | ||||
|     SysRecipesPlan getLastDayRecipesPlan(Long customerId, Long orderId); | ||||
|     SysRecipesPlan getLastDayRecipesPlan(Long customerId,  Date orderTime); | ||||
|  | ||||
|     /** | ||||
|      * 通过outId查询食谱计划简要 | ||||
|   | ||||
| @@ -229,7 +229,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | ||||
|      */ | ||||
|     private List<SysRecipesPlan> generatePlan(SysOrder sysOrder, LocalDate serverStartDate, LocalDate serverEndDate, List<SysOrderPause> pauseList) { | ||||
|         //查询在上一个订单最后一条食谱计划 | ||||
|         SysRecipesPlan beforeOrderLastPlan = getLastDayRecipesPlan(sysOrder.getCusId(), sysOrder.getOrderId()); | ||||
|         SysRecipesPlan beforeOrderLastPlan = getLastDayRecipesPlan(sysOrder.getCusId(), sysOrder.getOrderTime()); | ||||
|         int startNumDay = 0; | ||||
|         //之前是否存在食谱 | ||||
|         if(beforeOrderLastPlan != null){ | ||||
| @@ -409,11 +409,10 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | ||||
|     /** | ||||
|      * 根据客户ID查询最后一天食谱计划 | ||||
|      * @param customerId 客户ID | ||||
|      * @param orderId 不属于该订单ID的食谱 | ||||
|      * @return | ||||
|      */ | ||||
|     public SysRecipesPlan getLastDayRecipesPlan(Long customerId, Long orderId){ | ||||
|         return sysRecipesPlanMapper.getLastDayRecipesPlan(customerId, orderId); | ||||
|     public SysRecipesPlan getLastDayRecipesPlan(Long customerId, Date orderTime){ | ||||
|         return sysRecipesPlanMapper.getLastDayRecipesPlan(customerId, orderTime); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|   | ||||
| @@ -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"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user