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
<?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.ComplaintDeductmoneyMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.ComplaintDeductmoney">
        <id column="id" property="id" />
        <result column="createTime" property="createTime" />
        <result column="driverId" property="driverId" />
        <result column="money" property="money" />
        <result column="reason" property="reason" />
        <result column="complaintIds" property="complaintIds" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, createTime, driverId, money, reason, complaintIds
    </sql>
    <select id="getList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
        SELECT c.*,d.phone,d.`name` FROM t_complaint_deductmoney c LEFT JOIN t_driver d ON c.driverId=d.id
        <where>
            1=1  and d.companyId=#{companyId}
            <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
                AND (c.createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
            </if>
            <if test="userId != null and userId != ''">
                and find_in_set(driverId, #{userId})
            </if>
            <if test="phone != null and phone != ''">
                and d.phone  LIKE CONCAT('%',#{phone},'%')
            </if>
            <if test="name != null and name != ''">
                and d.name  LIKE CONCAT('%',#{name},'%')
            </if>
            <if test="id != null and id != ''">
                and c.id  LIKE CONCAT('%',#{id},'%')
            </if>
        </where>
    </select>
    <select id="getListEx" resultType="map">
        SELECT c.*,d.phone,d.`name` FROM t_complaint_deductmoney c LEFT JOIN t_driver d ON c.driverId=d.id
        <where>
            1=1  and d.companyId=#{companyId}
            <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
                AND (c.createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
            </if>
            <if test="userId != null and userId != ''">
                and find_in_set(driverId, #{userId})
            </if>
            <if test="phone != null and phone != ''">
                and d.phone  LIKE CONCAT('%',#{phone},'%')
            </if>
            <if test="name != null and name != ''">
                and d.name  LIKE CONCAT('%',#{name},'%')
            </if>
            <if test="id != null and id != ''">
                and c.id  LIKE CONCAT('%',#{id},'%')
            </if>
        </where>
    </select>
    <select id="getSumMoney" resultType="java.lang.Double">
        SELECT SUM(money) FROM t_complaint_deductmoney c LEFT JOIN t_driver d ON c.driverId=d.id
        <where>
            1=1  and d.companyId=#{companyId}
            <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
                AND (c.createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
            </if>
            <if test="userId != null and userId != ''">
                and find_in_set(driverId, #{userId})
            </if>
            <if test="phone != null and phone != ''">
                and d.phone  LIKE CONCAT('%',#{phone},'%')
            </if>
            <if test="name != null and name != ''">
                and d.name  LIKE CONCAT('%',#{name},'%')
            </if>
            <if test="id != null and id != ''">
                and c.id  LIKE CONCAT('%',#{id},'%')
            </if>
        </where>
    </select>
</mapper>