Pu Zhibing
2025-05-16 4c99ee7028c3fe58a2cd4b8273b22c75c45574fc
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
<?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.SettlementRecordMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.SettlementRecord">
        <id column="id" property="id"/>
        <result column="day" property="day"/>
        <result column="driverId" property="driverId"/>
        <result column="type" property="type"/>
        <result column="paymentStatus" property="paymentStatus"/>
        <result column="payMoney" property="payMoney"/>
        <result column="payType" property="payType"/>
        <result column="code" property="code"/>
        <result column="insertTime" property="insertTime"/>
    </resultMap>
 
 
 
    <select id="querySettlementRecordList" resultType="map">
        select
        a.id,
        DATE_FORMAT(a.`day`, '%Y-%m-%d') as `day`,
        a.payMoney,
        a.payType,
        a.paymentStatus,
        CONCAT(b.firstName, ' ', b.lastName) as driverName,
        DATE_FORMAT(a.payTime, '%Y-%m-%d %H:%i:%s') as payTime
        from t_settlement_record a
        left join t_driver b on (a.driverId = b.id)
        where 1 = 1
        <if test="null != startTime and '' != startTime and null != endTime and '' != endTime">
            and DATE_FORMAT(a.`day`, '%Y-%m-%d') between #{startTime} and #{endTime}
        </if>
        <if test="null != money">
            and a.payMoney = #{money}
        </if>
        <if test="null != status">
            and a.paymentStatus = #{status}
        </if>
        <if test="null != driverName">
            and CONCAT(b.firstName, ' ', b.lastName) like CONCAT('%', #{driverName}, '%')
        </if>
        order by a.insertTime desc
    </select>
</mapper>