超时记录同状态同子单有两条?默认先取时间较晚单那条记录

This commit is contained in:
donqi 2023-05-10 22:03:29 +08:00
parent e7cdfe188d
commit 5b1f10fadd
3 changed files with 9 additions and 3 deletions

View File

@ -10,7 +10,7 @@ import java.util.List;
*/ */
public interface OrderFineRecordMapper { public interface OrderFineRecordMapper {
OrderTimeoutRecord selectByDetailIdAndStatus(@Param("orderDetailId") Long orderDetailId, @Param("orderStatus") Integer orderStatus); List<OrderTimeoutRecord> selectByDetailIdAndStatus(@Param("orderDetailId") Long orderDetailId, @Param("orderStatus") Integer orderStatus);
List<OrderTimeoutRecord> selectList(OrderTimeoutRecord orderTimeoutRecord); List<OrderTimeoutRecord> selectList(OrderTimeoutRecord orderTimeoutRecord);

View File

@ -3,6 +3,7 @@ package com.ghy.payment.service.impl;
import com.ghy.payment.domain.OrderTimeoutRecord; import com.ghy.payment.domain.OrderTimeoutRecord;
import com.ghy.payment.mapper.OrderFineRecordMapper; import com.ghy.payment.mapper.OrderFineRecordMapper;
import com.ghy.payment.service.OrderFineRecordService; import com.ghy.payment.service.OrderFineRecordService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -21,7 +22,12 @@ public class OrderFineRecordServiceImpl implements OrderFineRecordService {
@Override @Override
public OrderTimeoutRecord selectByDetailIdAndStatus(Long orderDetailId, Integer orderStatus) { public OrderTimeoutRecord selectByDetailIdAndStatus(Long orderDetailId, Integer orderStatus) {
return orderFineRecordMapper.selectByDetailIdAndStatus(orderDetailId, orderStatus); OrderTimeoutRecord orderTimeoutRecord = null;
List<OrderTimeoutRecord> orderTimeoutRecords = orderFineRecordMapper.selectByDetailIdAndStatus(orderDetailId, orderStatus);
if (CollectionUtils.isNotEmpty(orderTimeoutRecords)) {
orderTimeoutRecord = orderTimeoutRecords.get(0);
}
return orderTimeoutRecord;
} }
@Override @Override

View File

@ -22,7 +22,7 @@
<select id="selectByDetailIdAndStatus" resultMap="OrderFineRecordResult"> <select id="selectByDetailIdAndStatus" resultMap="OrderFineRecordResult">
<include refid="selectOrderFineRecord"/> <include refid="selectOrderFineRecord"/>
WHERE order_detail_id = #{orderDetailId} AND order_status = #{orderStatus} WHERE order_detail_id = #{orderDetailId} AND order_status = #{orderStatus} order by create_time desc
</select> </select>
<select id="selectList" parameterType="com.ghy.payment.domain.OrderTimeoutRecord" <select id="selectList" parameterType="com.ghy.payment.domain.OrderTimeoutRecord"