Pu Zhibing
1 天以前 e809f5955584e600d8612540ea814977c49774c2
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
<?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.TAbnormalPayOrderMapper">
 
 
    <select id="list" resultType="java.util.Map">
        select o.id,o.recoveryOrderCreateDate as createTime, o.orderNum, t2.nickName userName, t2.phone userPhone, o.passengers, o.passengersPhone,o.state,o.payMoney,o.payTime
        from (
        select id,userId,recoveryOrderCreateDate,orderNum,passengers,passengersPhone,state,payMoney,companyId,payTime from t_order_private_car a where recoveryOrder = 1
        UNION all
        select id,userId,recoveryOrderCreateDate,orderNum,passengers,passengersPhone,state,payMoney,companyId,payTime from t_order_taxi a where recoveryOrder = 1
        ) o
        left join  t_user t2 on o.userId = t2.id
        where 1=1
        <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
            AND (o.recoveryOrderCreateDate between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
        </if>
        <if test="orderNum != null and orderNum != ''">
            and o.orderNum  LIKE CONCAT('%',#{orderNum},'%')
        </if>
        <if test="userName != null and userName != ''">
            and t2.nickName  LIKE CONCAT('%',#{userName},'%')
        </if>
        <if test="userPhone != null and userPhone != ''">
            and t2.phone  LIKE CONCAT('%',#{userPhone},'%')
        </if>
        <if test="passengers != null and passengers != ''">
            and o.passengers  LIKE CONCAT('%',#{passengers},'%')
        </if>
        <if test="passengersPhone != null and passengersPhone != ''">
            and o.passengersPhone  LIKE CONCAT('%',#{passengersPhone},'%')
        </if>
        <if test="roleType != null and roleType != '' and roleType == 2">
            and (o.companyId = #{nowUserId} or FIND_IN_SET(o.companyId,(SELECT GROUP_CONCAT(id) as ids FROM t_company where superiorId = #{nowUserId} GROUP BY superiorId)))
        </if>
        <if test="roleType != null and roleType != '' and roleType == 3">
            and o.companyId = #{nowUserId}
        </if>
        <if test="null != abnormalStatus and 1 == abnormalStatus">
            and o.state = 7
        </if>
        <if test="null != abnormalStatus and 2 == abnormalStatus">
            and o.state in (8, 9)
        </if>
        order by o.recoveryOrderCreateDate desc
    </select>
 
</mapper>