From 15e9561327a044c7d51f5f0a4aa73c07e574b11e Mon Sep 17 00:00:00 2001 From: xiezhijun <15270898033@163.com> Date: Thu, 15 Apr 2021 18:24:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=B8=8A=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=9C=80=E5=90=8E=E4=B8=80=E5=A4=A9=E9=A3=9F?= =?UTF-8?q?=E8=B0=B1=E8=AE=A1=E5=88=92=E6=94=B9=E4=B8=BA=E6=88=90=E4=BA=A4?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/stdiet/custom/mapper/SysRecipesPlanMapper.java | 5 ++++- .../com/stdiet/custom/service/ISysRecipesPlanService.java | 3 ++- .../custom/service/impl/SysRecipesPlanServiceImpl.java | 7 +++---- .../main/resources/mapper/custom/SysRecipesPlanMapper.xml | 8 +++++--- 4 files changed, 14 insertions(+), 9 deletions(-) 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