彭雪彬
2025-07-17 f7aecbb238953c233dc742e7363ec23b3f4e9882
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.oying.modules.rider.mapper.RiderOrderRecordMapper">
    <resultMap id="BaseResultMap" type="com.oying.modules.rider.domain.RiderOrderRecord">
        <id column="record_id" property="recordId"/>
        <result column="order_id" property="orderId"/>
        <result column="order_num" property="orderNum"/>
        <result column="merchant_id" property="merchantId"/>
        <result column="merchant_name" property="merchantName"/>
        <result column="merchant_address" property="merchantAddress"/>
        <result column="receiver_address" property="receiverAddress"/>
        <result column="order_status" property="orderStatus"/>
        <result column="accept_time" property="acceptTime"/>
        <result column="accept_num" property="acceptNum"/>
        <result column="finish_time" property="finishTime"/>
        <result column="delivery_duration" property="deliveryDuration"/>
        <result column="is_overtime" property="isOvertime"/>
        <result column="order_source" property="orderSource"/>
        <result column="order_income" property="orderIncome"/>
        <result column="create_by" property="createBy"/>
        <result column="create_time" property="createTime"/>
        <result column="update_by" property="updateBy"/>
        <result column="update_time" property="updateTime"/>
        <result column="rider_id" property="riderId"/>
        <result column="phone" property="phone"/>
        <result column="rider_name" property="riderName"/>
        <result column="user_longitude" property="userLongitude"/>
        <result column="user_latitude" property="userLatitude"/>
        <result column="merchant_longitude" property="merchantLongitude"/>
        <result column="merchant_latitude" property="merchantLatitude"/>
        <result column="user_id" property="userId"/>
        <result column="delivery_fee_id" property="deliveryFeeId"/>
        <result column="order_time" property="orderTime"/>
    </resultMap>
 
    <sql id="Base_Column_List">
        record_id,
        order_id,
        order_num,
        merchant_id,
        merchant_name,
        merchant_address,
        receiver_address,
        order_status,
        accept_time,
        accept_num,
        finish_time,
        delivery_duration,
        is_overtime,
        order_source,
        order_income,
        create_by,
        create_time,
        update_by,
        update_time,
        rider_id,
        phone,
        rider_name,
        user_id,
        user_longitude,
        user_latitude,
        merchant_longitude,
        merchant_latitude,
        delivery_fee_id,
        order_time
    </sql>
    <select id="findAll" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from qs_rider_order_record
        <where>
            <if test="criteria.riderId != null">
                and rider_id = #{criteria.riderId}
            </if>
            <if test="criteria.userId != null">
                and user_id = #{criteria.userId}
            </if>
            <if test="criteria.orderId != null">
                and order_id = #{criteria.orderId}
            </if>
            <if test="criteria.orderNum != null">
                and order_num = #{criteria.orderNum}
            </if>
            <if test="criteria.merchantId != null">
                and merchant_id = #{criteria.merchantId}
            </if>
            <if test="criteria.merchantName != null">
                and merchant_name like concat('%', #{criteria.merchantName}, '%')
            </if>
            <if test="criteria.merchantAddress != null">
                and merchant_address like concat('%', #{criteria.merchantAddress}, '%')
            </if>
            <if test="criteria.receiverAddress != null">
                and receiver_address like concat('%', #{criteria.receiverAddress}, '%')
            </if>
            <if test="criteria.orderStatus != null">
                and order_status = #{criteria.orderStatus}
            </if>
            <if test="criteria.isOvertime != null">
                and is_overtime = #{criteria.isOvertime}
            </if>
            <if test="criteria.acceptTime != null and criteria.acceptTime.size() > 0">
                AND accept_time BETWEEN #{criteria.acceptTime[0]} AND #{criteria.acceptTime[1]}
            </if>
            <if test="criteria.finishTime != null and criteria.finishTime.size() > 0">
                AND finish_time BETWEEN #{criteria.finishTime[0]} AND #{criteria.finishTime[1]}
            </if>
            <if test="criteria.createTime != null and criteria.createTime.size() > 0">
                AND create_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]}
            </if>
        </where>
        order by create_time desc
    </select>
 
    <select id="selectRiderInfo" resultType="com.oying.modules.rider.domain.RiderOrderRecord">
        select record_id recordId ,accept_time as acceptTime, order_time as orderTime
        from qs_rider_order_record where order_num = #{orderNum}
    </select>
</mapper>