xuhy
2025-01-09 712f70b2936079a131ecb1e63c6d337171618cad
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
<?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.stylefeng.guns.modular.system.dao.TTimeoutAppealMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TTimeoutAppeal">
        <id column="id" property="id" />
        <result column="createTime" property="createTime" />
        <result column="orderId" property="orderId" />
        <result column="driverId" property="driverId" />
        <result column="content" property="content" />
        <result column="imgList" property="imgList" />
        <result column="returnMoney" property="returnMoney" />
        <result column="state" property="state" />
        <result column="dealTime" property="dealTime" />
        <result column="remark" property="remark" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, createTime, orderId, driverId, content, imgList, returnMoney, state, dealTime, remark
    </sql>
 
 
    <select id="getAppealList" resultType="map">
        select
        ta.*,
        d.name driverName,
        d.phone driverPhone,
        ol.orderNum orderNum,
        case when ol.type = 4 then '同城物流'
        when ol.type = 5 then '跨城物流' end types,
        ol.timeOutMoney timeOutMoney,
        TIMESTAMPDIFF(MINUTE,ol.arriveTimeExpect,ol.endServiceTime) timeOut
        from t_timeout_appeal ta
        left join t_driver d
        on ta.driverId = d.id
        left join t_order_logistics ol
        on ta.orderId = ol.id
        <where>
            <if test="driverName != null and driverName != ''">
                and d.name like CONCAT('%',#{driverName},'%')
            </if>
            <if test="driverPhone != null and driverPhone != ''">
                and d.phone like CONCAT('%',#{driverPhone},'%')
            </if>
            <if test="orderNum != null and orderNum != ''">
                and ol.orderNum like CONCAT('%',#{orderNum},'%')
            </if>
            <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
                and ta.createTime between CONCAT(#{startTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')
            </if>
        </where>
        order by ta.id desc
    </select>
</mapper>