diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysRecipesPlanMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysRecipesPlanMapper.java index c51f62263..43cafab6f 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysRecipesPlanMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysRecipesPlanMapper.java @@ -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查询食谱计划 diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesPlanService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesPlanService.java index c9bd67c46..65aa040b6 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesPlanService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesPlanService.java @@ -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查询食谱计划简要 diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java index 8d0d204bd..562647294 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java @@ -229,7 +229,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { */ private List generatePlan(SysOrder sysOrder, LocalDate serverStartDate, LocalDate serverEndDate, List 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 diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml index b3e173ac4..6fe4eca81 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml @@ -63,9 +63,11 @@ - + 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