xuhy
2026-04-22 fa93c9eefcbfcb7ba8b7a9d0b41ba2b4e3523ae5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package com.xiaopeng.order.mapper;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xiaopeng.api.dto.statistics.DailyCountDTO;
import com.xiaopeng.api.model.order.XpOrder;
import com.xiaopeng.order.model.query.XpHistoryOrderListQuery;
import com.xiaopeng.order.model.vo.XpOrderHistoryListVO;
import org.apache.ibatis.annotations.Param;
 
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;
 
/**
 * <p>
 * 订单 Mapper 接口
 * </p>
 *
 * @author mitao
 * @since 2026-02-03
 */
public interface XpOrderMapper extends BaseMapper<XpOrder> {
 
    /**
     * 统计已完成订单总数(状态9=待评价或10=已完成)
     *
     * @return 订单总数
     */
    Long countCompletedOrders();
 
    /**
     * 统计时间范围内新增订单数(状态9或10)
     *
     * @param startDate 开始日期
     * @param endDate   结束日期
     * @return 新增订单数
     */
    Long countNewOrders(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);
 
    /**
     * 统计总交易金额(pay_money累加,状态9或10)
     *
     * @return 总交易金额
     */
    BigDecimal sumTotalMoney();
 
    /**
     * 获取每日新增订单数(状态9或10)
     *
     * @param startDate 开始日期
     * @param endDate   结束日期
     * @return 每日统计列表
     */
    List<DailyCountDTO> getDailyOrderCount(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);
 
    /**
     * 获取历史订单列表
     * @param page
     * @param query
     * @param uid
     * @return
     */
    List<XpOrderHistoryListVO> getHistoryOrderList(@Param("page") Page<XpOrderHistoryListVO> page, @Param("query") XpHistoryOrderListQuery query, @Param("uid") Long uid);
 
    List<XpOrder> getHistoryStartPoints(@Param("uid") Long uid, @Param("areaId") Long areaId);
 
 
    List<XpOrder> getHistoryEndPoints(@Param("uid") Long uid, @Param("areaId") Long areaId);
 
    Long countUserValidHistoryOrders(@Param("uid") Long uid);
 
    List<XpOrder> listUserRecentValidOrders(@Param("uid") Long uid, @Param("startTime") LocalDateTime startTime);
 
    List<Long> timeSceneOrders(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDateTime endDate, @Param("startMoment") LocalTime startMoment, @Param("endMoment") LocalTime endMoment, @Param("userId") Long userId);
 
    List<Long> frequencyOrders(LocalDate startDate, LocalDateTime endDate, LocalTime startMoment, LocalTime endMoment, Long userId);
}