liujie
22 小时以前 74f8b8074a2fb391b5363b4dca5f99bf31993430
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?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.TCheckCarActivityMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TCheckCarActivity">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="startTime" property="startTime" />
        <result column="endTime" property="endTime" />
        <result column="phone" property="phone" />
        <result column="address" property="address" />
        <result column="branchOfficeId" property="branchOfficeId" />
        <result column="provinceName" property="provinceName" />
        <result column="provinceCode" property="provinceCode" />
        <result column="cityName" property="cityName" />
        <result column="cityCode" property="cityCode" />
        <result column="districtName" property="districtName" />
        <result column="districtCode" property="districtCode" />
        <result column="couponName" property="couponName" />
        <result column="couponNum" property="couponNum" />
        <result column="receivedNum" property="receivedNum" />
        <result column="couponAmount" property="couponAmount" />
        <result column="duration" property="duration" />
        <result column="explainContent" property="explainContent" />
        <result column="auditStatus" property="auditStatus" />
        <result column="rejectReason" property="rejectReason" />
        <result column="auditTime" property="auditTime" />
        <result column="pauseFlag" property="pauseFlag" />
        <result column="qrCode" property="qrCode" />
        <result column="createTime" property="createTime" />
        <result column="updateTime" property="updateTime" />
        <result column="createBy" property="createBy" />
        <result column="updateBy" property="updateBy" />
        <result column="isDelete" property="isDelete" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, name, startTime, endTime, phone, address, branchOfficeId, provinceName, provinceCode, cityName, cityCode, districtName, districtCode, couponName, couponNum, receivedNum, couponAmount, duration, explainContent, auditStatus, rejectReason, auditTime, pauseFlag, qrCode, createTime, updateTime, createBy, updateBy, isDelete
    </sql>
    <select id="getOrderList" resultType="com.stylefeng.guns.modular.system.model.TCheckCarActivity">
        SELECT tcac.id,
               tcac.name,
               tcac.startTime,
               tcac.endTime,
               tcac.branchOfficeId,
               tcac.provinceName,
               tcac.provinceCode,
               tcac.cityName,
               tcac.cityCode,
               tcac.districtName,
               tcac.districtCode,
               tcac.couponName,
               tcac.couponNum,
               tcac.receivedNum,
               tcac.couponAmount,
               tcac.duration,
               tcac.explainContent,
               tcac.auditStatus,
               tcac.rejectReason,
               tcac.auditTime,
               tcac.pauseFlag,
               tcac.qrCode,
               tcac.createTime,
               tcac.updateTime,
               tcac.createBy,
               tcac.updateBy,
               tcac.isDelete,
               tbo.branchOfficeName
        FROM t_check_car_activity tcac
                 LEFT JOIN t_branch_office tbo ON tcac.branchOfficeId = tbo.id
        <where>
            <if test="beginTime != null and endTime != null">
                and tcac.createTime between #{beginTime} and #{endTime}
            </if>
            <if test="objectId != null and roleType != 1">
                and tcac.branchOfficeId = #{objectId}
            </if>
            <if test="branchOfficeName != null and branchOfficeName != ''">
                and tbo.branchOfficeName like concat('%',#{branchOfficeName},'%')
            </if>
            <if test="provinceCode != null and provinceCode != ''">
                and tcac.provinceCode = #{provinceCode}
            </if>
            <if test="name != null and name != ''">
                and tcac.name like concat('%', #{name},'%')
            </if>
            <if test="cityCode != null and cityCode != ''">
                and tcac.cityCode = #{cityCode}
            </if>
            <if test="areaCode != null and areaCode != ''">
                and tcac.areaCode = #{areaCode}
            </if>
            <if test="status != null and status == 1">
                and tcac.auditStatus = 0
            </if>
            <if test="status != null and status == 2">
                and tcac.auditStatus = 2
            </if>
            <if test="status != null and status == 3">
                and tcac.auditStatus = 1 and tcac.startTime &gt;= now()
            </if>
            <if test="status != null and status == 4">
                and tcac.auditStatus = 1 and tcac.startTime &lt; now() and tcac.endTime &gt;= now()
            </if>
            <if test="status != null and status == 5">
                and tcac.auditStatus = 1 and tcac.startTime &lt; now() and tcac.endTime &gt;= now() and tcac.pauseFlag = 1
            </if>
            <if test="status != null and status == 6">
                and tcac.auditStatus = 1 and tcac.endTime &lt; now()
            </if>
            AND tcac.isDelete = 0
        </where>
    ORDER BY tcac.createTime DESC
    </select>
 
</mapper>