Blame view

fw-valhalla-dao/src/main/resources/mapper/PubCluePoolMapper.xml 8.84 KB
1331548a   张志伟   :sparkles:
1
2
3
  <?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="cn.fw.valhalla.dao.mapper.PubCluePoolMapper">
bd5cb2d8   张志伟   feature(*): 修复成交池查询
4
5
6
7
8
9
10
11
12
13
14
      <select
              id="followList"
              resultType="cn.fw.valhalla.domain.dto.FollowPoolDTO"
              parameterType="cn.fw.valhalla.domain.query.FollowPoolQueryVO"
      >
          SELECT t1.id,
          t3.plate_no plate_no,
          t3.frame_no frame_no,
          t5.mobile mobile,
          t3.cus_level cus_level,
          t2.expires loan_expires,
06c394ca   张志伟   feature(*): 新增区域站...
15
          t1.clue_id clue_id,
bd5cb2d8   张志伟   feature(*): 修复成交池查询
16
          t1.type type,
3ee6424c   张志伟   feature(*): 修复成交池查询
17
          t6.source_type source_type,
bd5cb2d8   张志伟   feature(*): 修复成交池查询
18
19
20
21
22
23
24
25
26
27
28
29
30
31
          t1.follow_user user_id,
          t1.follow_user_name follow_user_name,
          t1.follow_shop shop_id,
          t1.finish_shop finish_shop,
          t1.finish_user_name finish_user_name,
          t1.create_time start_time,
          t3.buy_date buy_date,
          t3.insurance_expires insurance_expires,
          t3.arrival_time arrival_time,
          IFNULL(t1.times, 0) times,
          TIMESTAMPDIFF(HOUR, now(), t1.deadline) remaining,
          t1.state state,
          t1.close_time close_time,
          t1.reason initiative,
89bd2e6c   张志伟   feature(*): 新增区域站...
32
          t1.version version,
bd5cb2d8   张志伟   feature(*): 修复成交池查询
33
34
35
36
37
38
39
40
41
42
43
44
          t1.group_id group_id
          FROM clue_task t1
          left join pub_clue_pool t6 on t1.clue_id=t6.id
          left join customer t3 on t6.vin = t3.frame_no and t6.group_id = t3.group_id and t3.yn=1
          left join customer_base_info t5 on t3.base_id = t5.id
          left join customer_loan_info t2 on t6.vin = t2.frame_no and t6.group_id = t2.group_id
          <where>
              t1.group_id = #{condition.groupId}
              and t1.type = 10
              <if test="condition.userId !=null">
                  and t1.follow_user = #{condition.userId}
              </if>
8f3f3243   张志伟   feature(*): 修复bug
45
46
47
              <if test="condition.source != null">
                  and t6.source_type = #{condition.source}
              </if>
bd5cb2d8   张志伟   feature(*): 修复成交池查询
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
119
120
121
122
123
124
              <if test="condition.userName !=null and condition.userName != ''">
                  and t1.follow_user_name like concat('%',#{condition.userName},'%')
              </if>
              <if test="condition.plateNo != null and condition.plateNo !='' ">
                  and (t3.plate_no like concat('%', #{condition.plateNo}, '%') or t4.plate_no like concat('%',
                  #{condition.plateNo}, '%'))
              </if>
              <if test="condition.frameNo != null and condition.frameNo !='' ">
                  and t6.vin like concat('%', #{condition.frameNo}, '%')
              </if>
  
              <if test="condition.shopIds !=null">
                  and t1.follow_shop in
                  <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=",">
                      #{id}
                  </foreach>
              </if>
              <if test="condition.state != null">
                  and t1.state in
                  <foreach collection="condition.state" item="id" index="index" open="(" close=")" separator=",">
                      #{id}
                  </foreach>
              </if>
              <if test="condition.loanCustomer !=null and condition.loanCustomer == 1">
                  and t2.expires > now()
              </if>
              <if test="condition.loanCustomer !=null and condition.loanCustomer == 0">
                  and (t2.expires is null or t2.expires &lt;= now())
              </if>
              <if test="condition.startTime1 !=null">
                  and t1.create_time >= #{condition.startTime1}
              </if>
              <if test="condition.startTime2 !=null">
                  and t1.create_time &lt;= #{condition.startTime2}
              </if>
              <if test="condition.closeTime1 !=null or condition.closeTime2 !=null">
                  and ( t1.close_time is null or (
                  <trim prefixOverrides="and">
                      <if test="condition.closeTime1 !=null">
                          and t1.close_time >= #{condition.closeTime1}
                      </if>
                      <if test="condition.closeTime2 !=null">
                          and t1.close_time &lt;= #{condition.closeTime2}
                      </if>
                  </trim>
                  ))
              </if>
              <if test="condition.initiative !=null">
                  and t1.reason = #{condition.initiative}
              </if>
              <if test="condition.ignoreChangeRole != null">
                  and (t1.reason is null or t1.reason not in (4))
              </if>
          </where>
          <if test="condition.orderString != null and condition.orderString !='' ">
              ${condition.orderString}
          </if>
          limit #{startIndex},#{pageSize};
      </select>
  
      <select
              id="followListCount"
              resultType="java.lang.Long"
              parameterType="cn.fw.valhalla.domain.query.FollowPoolQueryVO"
      >
          SELECT count(t1.id)
          FROM clue_task t1
          left join pub_clue_pool t6 on t1.clue_id=t6.id
          left join customer t3 on t6.vin = t3.frame_no and t6.group_id = t3.group_id and t3.yn=1
          left join customer_base_info t5 on t3.base_id = t5.id
          left join customer_loan_info t2 on t6.vin = t2.frame_no and t6.group_id = t2.group_id
          <where>
              t1.group_id = #{condition.groupId}
              and t1.type = 10
              <if test="condition.userId !=null">
                  and t1.follow_user = #{condition.userId}
              </if>
8f3f3243   张志伟   feature(*): 修复bug
125
126
127
              <if test="condition.source != null">
                  and t6.source_type = #{condition.source}
              </if>
bd5cb2d8   张志伟   feature(*): 修复成交池查询
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
              <if test="condition.userName !=null and condition.userName != ''">
                  and t1.follow_user_name like concat('%',#{condition.userName},'%')
              </if>
              <if test="condition.plateNo != null and condition.plateNo !='' ">
                  and (t3.plate_no like concat('%', #{condition.plateNo}, '%') or t4.plate_no like concat('%',
                  #{condition.plateNo}, '%'))
              </if>
              <if test="condition.frameNo != null and condition.frameNo !='' ">
                  and t6.vin like concat('%', #{condition.frameNo}, '%')
              </if>
  
              <if test="condition.shopIds !=null">
                  and t1.follow_shop in
                  <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=",">
                      #{id}
                  </foreach>
              </if>
              <if test="condition.state != null">
                  and t1.state in
                  <foreach collection="condition.state" item="id" index="index" open="(" close=")" separator=",">
                      #{id}
                  </foreach>
              </if>
              <if test="condition.loanCustomer !=null and condition.loanCustomer == 1">
                  and t2.expires > now()
              </if>
              <if test="condition.loanCustomer !=null and condition.loanCustomer == 0">
                  and (t2.expires is null or t2.expires &lt;= now())
              </if>
              <if test="condition.startTime1 !=null">
                  and t1.create_time >= #{condition.startTime1}
              </if>
              <if test="condition.startTime2 !=null">
                  and t1.create_time &lt;= #{condition.startTime2}
              </if>
              <if test="condition.closeTime1 !=null or condition.closeTime2 !=null">
                  and ( t1.close_time is null or (
                  <trim prefixOverrides="and">
                      <if test="condition.closeTime1 !=null">
                          and t1.close_time >= #{condition.closeTime1}
                      </if>
                      <if test="condition.closeTime2 !=null">
                          and t1.close_time &lt;= #{condition.closeTime2}
                      </if>
                  </trim>
                  ))
              </if>
              <if test="condition.initiative !=null">
                  and t1.reason = #{condition.initiative}
              </if>
              <if test="condition.ignoreChangeRole != null">
                  and (t1.reason is null or t1.reason not in (4))
              </if>
          </where>
      </select>
bfac3874   xianpengcheng   public_report_dat...
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
  
  
      <select id="countPubCluePoolList" resultType="cn.fw.valhalla.domain.dto.PubCluePoolReportDTO" parameterType="cn.fw.valhalla.domain.dto.PubCluePoolReportQueryDTO">
          SELECT
          shop_id,
          shop_name,
          adviser_id,
          adviser_name,
          COUNT(*) total
          FROM
          pub_clue_pool
          <where>
              group_id = #{groupId}
              <if test="startDate != null">
                  and create_time <![CDATA[ >= ]]> #{startDate}
              </if>
              <if test="endDate != null">
                  and create_time <![CDATA[ <= ]]> #{endDate}
              </if>
              <if test="sourceTypes != null and sourceTypes.size > 0 ">
                  AND source_type IN
                  <foreach collection="sourceTypes" item="v" separator=" , " open="(" close=")">
                      #{v}
                  </foreach>
              </if>
          </where>
          GROUP BY
          shop_id,
          adviser_id
      </select>
  
  
1331548a   张志伟   :sparkles:
215
  </mapper>