查询上一个订单最后一天食谱计划改为成交时间排序
This commit is contained in:
parent
47ab6b1229
commit
15e9561327
@ -1,10 +1,13 @@
|
|||||||
package com.stdiet.custom.mapper;
|
package com.stdiet.custom.mapper;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||||
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import javax.xml.crypto.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 食谱计划Mapper接口
|
* 食谱计划Mapper接口
|
||||||
*
|
*
|
||||||
@ -87,7 +90,7 @@ public interface SysRecipesPlanMapper
|
|||||||
* @param customerId
|
* @param customerId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
SysRecipesPlan getLastDayRecipesPlan(@Param("customerId")Long customerId, @Param("orderId")Long orderId);
|
SysRecipesPlan getLastDayRecipesPlan(@Param("customerId")Long customerId, @Param("orderTime") Date orderTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据订单ID查询食谱计划
|
* 根据订单ID查询食谱计划
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.stdiet.custom.service;
|
package com.stdiet.custom.service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||||
@ -102,7 +103,7 @@ public interface ISysRecipesPlanService
|
|||||||
* @param customerId
|
* @param customerId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
SysRecipesPlan getLastDayRecipesPlan(Long customerId, Long orderId);
|
SysRecipesPlan getLastDayRecipesPlan(Long customerId, Date orderTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过outId查询食谱计划简要
|
* 通过outId查询食谱计划简要
|
||||||
|
@ -229,7 +229,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
|||||||
*/
|
*/
|
||||||
private List<SysRecipesPlan> generatePlan(SysOrder sysOrder, LocalDate serverStartDate, LocalDate serverEndDate, List<SysOrderPause> pauseList) {
|
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;
|
int startNumDay = 0;
|
||||||
//之前是否存在食谱
|
//之前是否存在食谱
|
||||||
if(beforeOrderLastPlan != null){
|
if(beforeOrderLastPlan != null){
|
||||||
@ -409,11 +409,10 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
|||||||
/**
|
/**
|
||||||
* 根据客户ID查询最后一天食谱计划
|
* 根据客户ID查询最后一天食谱计划
|
||||||
* @param customerId 客户ID
|
* @param customerId 客户ID
|
||||||
* @param orderId 不属于该订单ID的食谱
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public SysRecipesPlan getLastDayRecipesPlan(Long customerId, Long orderId){
|
public SysRecipesPlan getLastDayRecipesPlan(Long customerId, Date orderTime){
|
||||||
return sysRecipesPlanMapper.getLastDayRecipesPlan(customerId, orderId);
|
return sysRecipesPlanMapper.getLastDayRecipesPlan(customerId, orderTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -63,9 +63,11 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 根据用户ID查询是否存在该用户该订单之前的最后一条食谱 -->
|
<!-- 根据用户ID查询是否存在该用户该订单之前的最后一条食谱 -->
|
||||||
<select id="getLastDayRecipesPlan" resultMap="SysRecipesPlanResult" parameterType="Long">
|
<select id="getLastDayRecipesPlan" resultMap="SysRecipesPlanResult">
|
||||||
<include refid="selectSysRecipesPlanVo"/>
|
select srp.*
|
||||||
where cus_id = #{customerId} and del_flag = 0 and #{orderId} > order_id order by end_num_day DESC limit 1
|
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>
|
</select>
|
||||||
|
|
||||||
<insert id="insertSysRecipesPlan" parameterType="SysRecipesPlan" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertSysRecipesPlan" parameterType="SysRecipesPlan" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user