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
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
<?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.TTaxiCardMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TTaxiCard">
        <id column="id" property="id" />
        <result column="companyId" property="companyId" />
        <result column="name" property="name" />
        <result column="type" property="type" />
        <result column="openCityId" property="openCityId" />
        <result column="validDate" property="validDate" />
        <result column="originalPrice" property="originalPrice" />
        <result column="sellingPrice" property="sellingPrice" />
        <result column="content" property="content" />
        <result column="note" property="note" />
        <result column="state" property="state" />
        <result column="createTime" property="createTime" />
        <result column="createUserId" property="createUserId" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, companyId, name, type, openCityId, validDate, originalPrice, sellingPrice, content, note, state, createTime, createUserId
    </sql>
 
    <select id="tTaxiCardPaymentList" resultType="map">
        select
        p.id,
        p.createTime,
        u.nickName,
        u.phone,
        c.name cardName,
        p.payMoney
        from t_taxi_card_payment p
        left join t_taxi_card c
        on p.taxiCardId = c.id
        left join t_user u
        on p.userId = u.id
        where p.taxiCardId = #{cardId}
        <if test="name != null and name != ''">
             and u.nickName like CONCAT('%',#{name},'%')
        </if>
        <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
             and (p.createTime between CONCAT(#{startTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
        </if>
        order by p.id desc
    </select>
 
    <select id="tTaxiCardPaymentLists" resultType="map">
        select
        p.id,
        p.createTime,
        u.nickName,
        u.phone,
        c.name cardName,
        p.payMoney
        from t_taxi_card_payment p
        left join t_taxi_card c
        on p.taxiCardId = c.id
        left join t_user u
        on p.userId = u.id
        where p.taxiCardId = #{cardId}
        <if test="name != null and name != ''">
            and u.nickName like CONCAT('%',#{name},'%')
        </if>
        <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
            and (p.createTime between CONCAT(#{startTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
        </if>
        order by p.id desc
    </select>
 
    <select id="searchRecordDetail" resultType="map">
        select
        u.nickName,
        u.phone,
        p.payMoney,
        p.createTime,
        c.name cardName,
        c.content,
        c.companyCityId,
        c.note,
        c.validDate
        from t_taxi_card_payment p
        left join t_user u on p.userId = u.id
        left join t_taxi_card c on p.taxiCardId = c.id
        where p.id = #{paymentId}
    </select>
 
    <select id="AllCardMoney" resultType="double">
        select sum(payMoney) from t_taxi_card_payment where companyId = #{companyId}
    </select>
</mapper>