9ad4f1a4
张志伟
|
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.CustomerMapper">
|
67ad6e9a
张志伟
|
4
5
6
7
8
9
10
11
12
13
14
|
<select
id="getAppPageList"
resultType="cn.fw.valhalla.domain.vo.customer.CustomerListVO"
parameterType="cn.fw.valhalla.domain.query.CustomerQueryVO"
>
SELECT
t1.id, name AS ownerName, t1.car_image, t1.plate_no, t1.cus_level, t1.frame_no,
CONCAT_WS(' ', NULLIF(t1.brand_name, ''), NULLIF(t1.series_name, ''), NULLIF(t1.spec_name, '')) AS carName,
t1.tags
FROM customer t1 left join customer_base_info t2 on t1.base_id = t2.id
<where>
|
81778297
张志伟
|
15
|
t1.yn = 1
|
67ad6e9a
张志伟
|
16
17
18
19
20
|
<if test="condition.keyword != null and condition.keyword !='' ">
and (t2.`name` like concat('%', #{condition.keyword}, '%')
or t1.`plate_no` like concat('%', #{condition.keyword}, '%')
or t1.`frame_no` like concat('%', #{condition.keyword}, '%'))
</if>
|
240a6575
张志伟
|
21
22
23
|
<if test="condition.regionCode !=null and condition.regionCode != ''">
and t2.city_code like concat(#{condition.regionCode}, '%')
</if>
|
67ad6e9a
张志伟
|
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
|
<if test="condition.companyName != null and condition.companyName != ''">
and t2.`company_name` like concat('%', #{condition.keyword}, '%')
</if>
<if test="condition != null and condition.levels != null and condition.levels.size > 0">
and t1.cus_level IN
<foreach collection="condition.levels" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="condition != null and condition.tags != null and condition.tags.size() > 0">
and
<foreach collection="condition.tags" item="item" separator="or" open="(" close=")">
t1.tags LIKE concat('%', #{item}, '%')
</foreach>
</if>
<if test="condition.brandId !=null">
and t1.brand_id = #{condition.brandId}
</if>
<if test="condition.seriesId !=null">
and t1.series_id = #{condition.seriesId}
</if>
<if test="condition.specId !=null">
and t1.spec_id = #{condition.specId}
</if>
<if test="condition.gender !=null">
and t2.gender = #{condition.gender}
</if>
<if test="condition.cusType !=null">
and t2.cus_type = #{condition.cusType}
</if>
<if test="condition.month !=null">
and month(t2.birthday) = #{condition.month}
</if>
<if test="condition.endBirthday !=null">
and t2.birthday >= #{condition.endBirthday}
</if>
<if test="condition.startBirthday !=null">
and t2.birthday <= #{condition.startBirthday}
</if>
<if test="condition.leftCreatTime !=null">
and t1.create_time >= #{condition.leftCreatTime}
</if>
<if test="condition.rightCreatTime !=null">
and t1.create_time <= #{condition.rightCreatTime}
</if>
<if test="condition != null and condition.shopIds != null and condition.shopIds.size() > 0">
and t1.shop_id IN
<foreach collection="condition.shopIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="condition.groupId !=null">
and t1.group_id = #{condition.groupId}
</if>
<if test="condition.consultantId !=null">
and t1.adviser_id = #{condition.consultantId}
</if>
|
66271e22
张志伟
|
81
82
83
84
85
86
|
<if test="condition != null and condition.customerIdList != null and condition.customerIdList.size > 0">
and t1.id IN
<foreach collection="condition.customerIdList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
|
67ad6e9a
张志伟
|
87
88
89
90
|
</where>
order by t1.create_time desc
limit #{startIndex},#{pageSize};
</select>
|
240a6575
张志伟
|
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
<select
id="analyseList"
resultType="cn.fw.valhalla.domain.dto.StammkundeAnalyseDTO"
parameterType="cn.fw.valhalla.domain.query.StammkundeAnalyseQueryVO"
>
select distinct
t1.id customer_id,
t1.plate_no,
t2.contact customer_name,
t2.address,
t2.city_code region_code,
t2.city_name region_name,
t2.lat,
t2.lng
from customer t1 inner join customer_base_info t2 on t1.base_id = t2.id
|
f2d43a7a
张志伟
|
107
|
where t1.yn = 1 and t1.group_id = #{condition.groupId} and t2.city_code is not null
|
240a6575
张志伟
|
108
109
110
111
112
113
|
<if test="condition.customerIds !=null">
and t1.id in
<foreach collection="condition.customerIds" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
|
f123b61e
张志伟
|
114
115
116
117
118
119
|
<if test="condition.shopIds !=null">
and t1.shop_id in
<foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
|
240a6575
张志伟
|
120
121
122
123
124
125
126
127
128
129
130
131
132
|
<if test="condition.minLat !=null">
and t2.lat >= #{condition.minLat}
</if>
<if test="condition.maxLat !=null">
and t2.lat <= #{condition.maxLat}
</if>
<if test="condition.minLng !=null">
and t2.lng >= #{condition.minLng}
</if>
<if test="condition.maxLng !=null">
and t2.lng <= #{condition.maxLng}
</if>
</select>
|
03c1a9b3
张志伟
|
133
134
135
136
137
138
139
140
141
|
<select
id="queryCustomList"
resultType="cn.fw.valhalla.domain.dto.CustomerDetailDto"
parameterType="cn.fw.valhalla.domain.query.CustomCustomerQuery"
>
select distinct
t1.*,
t2.contact name,
|
9f0183f7
张志伟
|
142
143
|
t2.member_id member_id,
t2.mobile
|
03c1a9b3
张志伟
|
144
|
from customer t1 inner join customer_base_info t2 on t1.base_id = t2.id
|
7fe573d9
张志伟
bug修复
|
145
146
|
left join follow_clue t3 on t1.frame_no=t3.vin and t3.clue_state=2 and t3.clue_type=2
left join follow_clue t4 on t1.frame_no=t4.vin and t4.clue_state=2 and t4.clue_type=4
|
03c1a9b3
张志伟
|
147
|
where t1.yn = 1 and t1.group_id = #{condition.groupId}
|
a78dc8be
张志伟
feature(*): 查询的bug修复
|
148
|
and t1.adviser_id is not null
|
655c423d
张志伟
|
149
|
<if test="condition.shopList !=null and condition.shopList.size() != 0">
|
03c1a9b3
张志伟
|
150
151
152
153
154
|
and t1.shop_id in
<foreach collection="condition.shopList" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
|
16dd4b9b
张志伟
|
155
|
<if test="condition.excludeCustomerIds !=null and condition.excludeCustomerIds.size() != 0">
|
655c423d
张志伟
|
156
157
158
159
160
|
and t1.id not in
<foreach collection="condition.excludeCustomerIds" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
|
5b538595
张志伟
feature(*): 新增查询线...
|
161
|
<if test="condition.includePublic != true">
|
b5de742c
张志伟
|
162
|
and (t1.temporary is null or t1.temporary = 0)
|
5b538595
张志伟
feature(*): 新增查询线...
|
163
|
</if>
|
03c1a9b3
张志伟
|
164
165
166
167
168
169
170
171
172
173
174
|
<if test="condition.followType !=null and condition.followType==2">
and t3.id is not null
</if>
<if test="condition.followType !=null and condition.followType==4">
and t4.id is not null
</if>
<if test="condition.frameNo !=null">
and t1.frame_no = #{condition.frameNo}
</if>
<if test="condition.andCondition==true">
and (
|
fc56d8af
张志伟
feature(*): 查询的bug修复
|
175
176
177
178
179
180
181
182
|
<trim prefixOverrides="and">
<if test="condition.minMileage !=null and condition.maxMileage !=null">
<if test="condition.minMileage !=null">
and t1.current_mileage >= #{condition.minMileage}
</if>
<if test="condition.maxMileage !=null">
and t1.current_mileage <= #{condition.maxMileage}
</if>
|
03c1a9b3
张志伟
|
183
|
</if>
|
03c1a9b3
张志伟
|
184
|
|
fc56d8af
张志伟
feature(*): 查询的bug修复
|
185
186
187
188
189
190
191
|
<if test="condition.minBuyDate !=null and condition.maxBuyDate !=null">
<if test="condition.minBuyDate !=null">
and t1.buy_date >= #{condition.minBuyDate}
</if>
<if test="condition.maxBuyDate !=null">
and t1.buy_date <= #{condition.maxBuyDate}
</if>
|
03c1a9b3
张志伟
|
192
|
</if>
|
03c1a9b3
张志伟
|
193
|
|
fc56d8af
张志伟
feature(*): 查询的bug修复
|
194
195
196
|
<if test="condition.level !=null">
and t1.cus_level = #{condition.level}
</if>
|
a78dc8be
张志伟
feature(*): 查询的bug修复
|
197
|
and t1.adviser_id is not null
|
fc56d8af
张志伟
feature(*): 查询的bug修复
|
198
|
</trim>
|
03c1a9b3
张志伟
|
199
200
201
202
203
|
)
</if>
<if test="condition.andCondition==false">
and (
|
fc56d8af
张志伟
feature(*): 查询的bug修复
|
204
205
206
207
208
209
210
211
212
213
214
|
<trim prefixOverrides="or">
<if test="condition.minMileage !=null and condition.maxMileage !=null">
or (
t1.current_mileage is not null
<if test="condition.minMileage !=null">
and t1.current_mileage >= #{condition.minMileage}
</if>
<if test="condition.maxMileage !=null">
and t1.current_mileage <= #{condition.maxMileage}
</if>
)
|
1ca0a771
张志伟
新增查询档案数量接口
|
215
|
</if>
|
1ca0a771
张志伟
新增查询档案数量接口
|
216
|
|
fc56d8af
张志伟
feature(*): 查询的bug修复
|
217
218
219
220
221
222
223
224
225
226
|
<if test="condition.minBuyDate !=null and condition.maxBuyDate !=null">
or (
t1.buy_date is not null
<if test="condition.minBuyDate !=null">
and t1.buy_date >= #{condition.minBuyDate}
</if>
<if test="condition.maxBuyDate !=null">
and t1.buy_date <= #{condition.maxBuyDate}
</if>
)
|
1ca0a771
张志伟
新增查询档案数量接口
|
227
|
</if>
|
1ca0a771
张志伟
新增查询档案数量接口
|
228
|
|
fc56d8af
张志伟
feature(*): 查询的bug修复
|
229
230
231
232
|
<if test="condition.level !=null">
or t1.cus_level = #{condition.level}
</if>
</trim>
|
1ca0a771
张志伟
新增查询档案数量接口
|
233
234
235
236
237
238
239
240
241
242
243
|
)
</if>
</select>
<select
id="queryCustomCount"
resultType="java.lang.Long"
parameterType="cn.fw.valhalla.domain.query.CustomCustomerQuery"
>
select count(1)
from customer t1 inner join customer_base_info t2 on t1.base_id = t2.id
|
5b538595
张志伟
feature(*): 新增查询线...
|
244
245
|
left join follow_clue t3 on t1.frame_no=t3.vin and t3.clue_state=2 and t3.clue_type=2
left join follow_clue t4 on t1.frame_no=t4.vin and t4.clue_state=2 and t4.clue_type=4
|
1ca0a771
张志伟
新增查询档案数量接口
|
246
|
where t1.yn = 1 and t1.group_id = #{condition.groupId}
|
a78dc8be
张志伟
feature(*): 查询的bug修复
|
247
|
and t1.adviser_id is not null
|
1ca0a771
张志伟
新增查询档案数量接口
|
248
249
250
251
252
253
254
255
256
257
258
259
|
<if test="condition.shopList !=null and condition.shopList.size() != 0">
and t1.shop_id in
<foreach collection="condition.shopList" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
<if test="condition.excludeCustomerIds !=null and condition.excludeCustomerIds.size() != 0">
and t1.id not in
<foreach collection="condition.excludeCustomerIds" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
|
5b538595
张志伟
feature(*): 新增查询线...
|
260
|
<if test="condition.includePublic != true">
|
b5de742c
张志伟
|
261
|
and (t1.temporary is null or t1.temporary = 0)
|
5b538595
张志伟
feature(*): 新增查询线...
|
262
|
</if>
|
1ca0a771
张志伟
新增查询档案数量接口
|
263
264
265
266
267
268
269
270
271
272
273
|
<if test="condition.followType !=null and condition.followType==2">
and t3.id is not null
</if>
<if test="condition.followType !=null and condition.followType==4">
and t4.id is not null
</if>
<if test="condition.frameNo !=null">
and t1.frame_no = #{condition.frameNo}
</if>
<if test="condition.andCondition==true">
and (
|
77d74af7
张志伟
feature(*): 查询的bug修复
|
274
275
276
277
278
279
280
281
|
<trim prefixOverrides="and">
<if test="condition.minMileage !=null and condition.maxMileage !=null">
<if test="condition.minMileage !=null">
and t1.current_mileage >= #{condition.minMileage}
</if>
<if test="condition.maxMileage !=null">
and t1.current_mileage <= #{condition.maxMileage}
</if>
|
1ca0a771
张志伟
新增查询档案数量接口
|
282
|
</if>
|
77d74af7
张志伟
feature(*): 查询的bug修复
|
283
284
285
286
287
288
289
290
|
<if test="condition.minBuyDate !=null and condition.maxBuyDate !=null">
<if test="condition.minBuyDate !=null">
and t1.buy_date >= #{condition.minBuyDate}
</if>
<if test="condition.maxBuyDate !=null">
and t1.buy_date <= #{condition.maxBuyDate}
</if>
|
1ca0a771
张志伟
新增查询档案数量接口
|
291
|
</if>
|
1ca0a771
张志伟
新增查询档案数量接口
|
292
|
|
77d74af7
张志伟
feature(*): 查询的bug修复
|
293
294
295
|
<if test="condition.level !=null">
and t1.cus_level = #{condition.level}
</if>
|
a78dc8be
张志伟
feature(*): 查询的bug修复
|
296
|
and t1.adviser_id is not null
|
77d74af7
张志伟
feature(*): 查询的bug修复
|
297
|
</trim>
|
1ca0a771
张志伟
新增查询档案数量接口
|
298
299
300
301
302
|
)
</if>
<if test="condition.andCondition==false">
and (
|
77d74af7
张志伟
feature(*): 查询的bug修复
|
303
304
|
<trim prefixOverrides="or">
<if test="condition.minMileage !=null and condition.maxMileage !=null">
|
a78dc8be
张志伟
feature(*): 查询的bug修复
|
305
|
or (t1.current_mileage is not null
|
77d74af7
张志伟
feature(*): 查询的bug修复
|
306
307
308
309
310
311
312
|
<if test="condition.minMileage !=null">
and t1.current_mileage >= #{condition.minMileage}
</if>
<if test="condition.maxMileage !=null">
and t1.current_mileage <= #{condition.maxMileage}
</if>
)
|
03c1a9b3
张志伟
|
313
|
</if>
|
03c1a9b3
张志伟
|
314
|
|
77d74af7
张志伟
feature(*): 查询的bug修复
|
315
316
317
318
319
320
321
322
323
324
|
<if test="condition.minBuyDate !=null and condition.maxBuyDate !=null">
or (
t1.buy_date is not null
<if test="condition.minBuyDate !=null">
and t1.buy_date >= #{condition.minBuyDate}
</if>
<if test="condition.maxBuyDate !=null">
and t1.buy_date <= #{condition.maxBuyDate}
</if>
)
|
03c1a9b3
张志伟
|
325
|
</if>
|
03c1a9b3
张志伟
|
326
|
|
77d74af7
张志伟
feature(*): 查询的bug修复
|
327
328
329
330
|
<if test="condition.level !=null">
or t1.cus_level = #{condition.level}
</if>
</trim>
|
03c1a9b3
张志伟
|
331
332
333
|
)
</if>
</select>
|
1983befb
张志伟
feat(api): :spark...
|
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
|
<select
id="queryByKeyword"
resultType="cn.fw.valhalla.sdk.result.BasicsCustomerDTO"
>
select t1.id customer_id,
t2.name customer_name,
t2.member_id member_id,
t2.cus_type cus_type,
t1.plate_no plate_no,
t1.frame_no frame_no,
concat_ws(' ', t1.brand_name, t1.series_name, t1.spec_name) car_name,
t1.shop_id,
t1.adviser_id
from customer t1
inner join customer_base_info t2 on t1.base_id = t2.id
where t1.yn = 1
and (
t1.plate_no = #{keyword}
or right(t1.frame_no, 6) = #{keyword}
or t2.name = #{keyword}
)
and t1.group_id = #{groupId}
</select>
|
3bddceac
夏天
查询保有客档案sdk
|
358
359
360
361
|
<select id="queryShopCusCnt"
parameterType="cn.fw.valhalla.sdk.param.CusCntReq"
resultType="cn.fw.valhalla.sdk.result.CusCntResult">
|
f0695a76
夏天
查询保有客档案sdk
|
362
363
|
select t1.shop_id as id,COUNT(t1.id) as cnt
from customer t1
|
3bddceac
夏天
查询保有客档案sdk
|
364
365
366
367
368
369
370
371
372
373
374
375
376
|
where t1.yn = 1
<if test="req.shopIds !=null and req.shopIds.size() != 0">
and t1.shop_id in
<foreach collection="req.shopIds" item="shopId" index="index" open="(" close=")" separator=",">
#{shopId}
</foreach>
group by t1.shop_id
</if>
</select>
<select id="queryAdviserCusCnt"
parameterType="cn.fw.valhalla.sdk.param.CusCntReq"
resultType="cn.fw.valhalla.sdk.result.CusCntResult">
|
f0695a76
夏天
查询保有客档案sdk
|
377
|
select t1.adviser_id as id,COUNT(t1.id) as cnt
|
3bddceac
夏天
查询保有客档案sdk
|
378
379
380
381
382
383
384
385
386
387
|
from customer t1
where t1.yn = 1
<if test="req.adviserIds !=null and req.adviserIds.size() != 0">
and t1.adviser_id in
<foreach collection="req.adviserIds" item="adviserId" index="index" open="(" close=")" separator=",">
#{adviserId}
</foreach>
group by t1.adviser_id
</if>
</select>
|
9ad4f1a4
张志伟
|
388
|
</mapper>
|