|
@@ -140,9 +140,9 @@ FROM
|
140
|
140
|
</select>
|
141
|
141
|
|
142
|
142
|
|
143
|
|
- <select id="selectRecentlyCount" >
|
|
143
|
+ <select id="selectRecentlyCount" resultType="integer" >
|
144
|
144
|
SELECT
|
145
|
|
- SUM(activity_count)
|
|
145
|
+ SUM(activity_count) as activity_count
|
146
|
146
|
FROM
|
147
|
147
|
(
|
148
|
148
|
SELECT
|
|
@@ -164,7 +164,7 @@ FROM
|
164
|
164
|
FROM
|
165
|
165
|
ta_person tp
|
166
|
166
|
INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
|
167
|
|
- where tp.person_type != #{personType}
|
|
167
|
+ where ifnull(tp.person_type, '') != #{personType}
|
168
|
168
|
) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
|
169
|
169
|
</select>
|
170
|
170
|
|
|
@@ -190,11 +190,12 @@ FROM
|
190
|
190
|
SELECT
|
191
|
191
|
COUNT(1) as activityCount,
|
192
|
192
|
tpvr.visit_time AS visitTime,
|
193
|
|
- tpvr.activity as activity
|
|
193
|
+ tbet.type_name as activity
|
194
|
194
|
FROM
|
195
|
195
|
ta_person tp
|
196
|
196
|
INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
|
197
|
|
- where tp.person_type != #{personType}
|
|
197
|
+ INNER JOIN td_biz_event_type tbet ON tpvr.event_type = tbet.type_id
|
|
198
|
+ where ifnull(tp.person_type, '') != #{personType}
|
198
|
199
|
GROUP BY tpvr.activity
|
199
|
200
|
) AS temp ON temp_date.date = DATE_FORMAT( temp.visitTime , '%Y-%m-%d' )
|
200
|
201
|
</select>
|
|
@@ -205,13 +206,13 @@ FROM
|
205
|
206
|
FROM
|
206
|
207
|
(
|
207
|
208
|
SELECT
|
208
|
|
- <if test="dateType === 'day'">
|
|
209
|
+ <if test="dateType == 'day'.toString()">
|
209
|
210
|
DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
|
210
|
211
|
</if>
|
211
|
|
- <if test="dateType === 'week'">
|
|
212
|
+ <if test="dateType == 'week'.toString()">
|
212
|
213
|
DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum WEEK ), '%Y-%m-%d' ) AS date
|
213
|
214
|
</if>
|
214
|
|
- <if test="dateType === 'month'">
|
|
215
|
+ <if test="dateType == 'month'.toString()">
|
215
|
216
|
DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum MONTH ), '%Y-%m-%d' ) AS date
|
216
|
217
|
</if>
|
217
|
218
|
FROM
|
|
@@ -231,7 +232,7 @@ FROM
|
231
|
232
|
FROM
|
232
|
233
|
ta_person tp
|
233
|
234
|
INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
|
234
|
|
- where tp.person_type != #{personType}
|
|
235
|
+ where ifnull(tp.person_type, '') != #{personType}
|
235
|
236
|
) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
|
236
|
237
|
</select>
|
237
|
238
|
|
|
@@ -265,7 +266,7 @@ FROM
|
265
|
266
|
FROM
|
266
|
267
|
ta_person tp
|
267
|
268
|
INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
|
268
|
|
- where tp.person_type != #{personType}
|
|
269
|
+ where ifnull(tp.person_type, '') != #{personType}
|
269
|
270
|
and tp.phone is NOT NULL
|
270
|
271
|
) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
|
271
|
272
|
) as authorization_count_table
|
|
@@ -293,17 +294,17 @@ FROM
|
293
|
294
|
FROM
|
294
|
295
|
ta_person tp
|
295
|
296
|
INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
|
296
|
|
- where tp.person_type != #{personType}
|
|
297
|
+ where ifnull(tp.person_type, '') != #{personType}
|
297
|
298
|
) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
|
298
|
299
|
|
299
|
300
|
) as user_count_table
|
300
|
301
|
GROUP BY date
|
301
|
302
|
</select>
|
302
|
303
|
|
303
|
|
- <select id="selectUserSourcePie">
|
|
304
|
+ <select id="selectUserSourcePie" resultType="integer">
|
304
|
305
|
select count(1)
|
305
|
306
|
FROM ta_person
|
306
|
|
- WHERE person_type != #{personType}
|
|
307
|
+ WHERE ifnull(person_type, '') != #{personType}
|
307
|
308
|
<if test="recommendPersonType != null and recommendPersonType != ''">
|
308
|
309
|
and recommend_person_type = #{recommendPersonType}
|
309
|
310
|
</if>
|
|
@@ -319,12 +320,12 @@ FROM
|
319
|
320
|
LEFT JOIN td_person_from tpfs
|
320
|
321
|
ON tps.from_code = tpfs.from_code
|
321
|
322
|
WHERE tpfs.from_code = tpf.from_code and tps.phone is NOT NULL
|
322
|
|
- and tps.person_type != #{personType}
|
|
323
|
+ and ifnull(tps.person_type, '') != #{personType}
|
323
|
324
|
<if test="startDate != null or endDate != null">
|
324
|
325
|
and tps.create_date BETWEEN #{startDate} and #{endDate}
|
325
|
326
|
</if>
|
326
|
327
|
<if test="startDate == null or endDate == null">
|
327
|
|
- and tps.create_date BETWEEN DATE_SUB( tp.create_date, INTERVAL 7 DAY ) and now()
|
|
328
|
+ and tps.create_date BETWEEN DATE_SUB( tps.create_date, INTERVAL 7 DAY ) and now()
|
328
|
329
|
</if>
|
329
|
330
|
) as registered,
|
330
|
331
|
(
|
|
@@ -334,21 +335,54 @@ FROM
|
334
|
335
|
LEFT JOIN td_person_from tpfs
|
335
|
336
|
ON tps.from_code = tpfs.from_code
|
336
|
337
|
WHERE tpfs.from_code = tpf.from_code
|
337
|
|
- and tps.person_type != #{personType}
|
|
338
|
+ and ifnull(tps.person_type, '') != #{personType}
|
338
|
339
|
<if test="startDate != null or endDate != null">
|
339
|
340
|
and tps.create_date BETWEEN #{startDate} and #{endDate}
|
340
|
341
|
</if>
|
341
|
342
|
<if test="startDate == null or endDate == null">
|
342
|
|
- and tps.create_date BETWEEN DATE_SUB( tp.create_date, INTERVAL 7 DAY ) and now()
|
|
343
|
+ and tps.create_date BETWEEN DATE_SUB( tps.create_date, INTERVAL 7 DAY ) and now()
|
343
|
344
|
</if>
|
344
|
345
|
) as user_count
|
345
|
346
|
|
346
|
347
|
FROM td_person_from tpf
|
347
|
348
|
LEFT JOIN ta_person tp
|
348
|
349
|
ON tp.from_code = tpf.from_code
|
349
|
|
- where tp.person_type != #{personType}
|
|
350
|
+ where ifnull(tp.person_type, '') != #{personType}
|
350
|
351
|
GROUP BY tpf.from_code
|
351
|
352
|
</select>
|
352
|
353
|
|
|
354
|
+ <select id="selectUserSourceData" resultType="map">
|
|
355
|
+ select
|
|
356
|
+ *
|
|
357
|
+ FROM
|
|
358
|
+ (
|
|
359
|
+ SELECT
|
|
360
|
+ DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
|
|
361
|
+ FROM
|
|
362
|
+ sequence a
|
|
363
|
+ WHERE
|
|
364
|
+ <if test="startDate == null or endDate == null">
|
|
365
|
+ a.rownum <![CDATA[ <= ]]> 7
|
|
366
|
+ </if>
|
|
367
|
+ <if test="startDate != null or endDate != null">
|
|
368
|
+ a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
|
369
|
+ </if>
|
|
370
|
+ ) AS temp_date
|
|
371
|
+ LEFT JOIN
|
|
372
|
+ (
|
|
373
|
+ SELECT
|
|
374
|
+ COUNT(1) as count,
|
|
375
|
+ tps.create_date as create_date,
|
|
376
|
+ tpfs.from_code as from_code,
|
|
377
|
+ tpfs.from_name as from_name
|
|
378
|
+ FROM ta_person tps
|
|
379
|
+ LEFT JOIN td_person_from tpfs
|
|
380
|
+ ON tps.from_code = tpfs.from_code
|
|
381
|
+ WHERE tpfs.from_code = tps.from_code
|
|
382
|
+ and ifnull(tps.person_type, '') != #{personType}
|
|
383
|
+ GROUP BY tpfs.from_code
|
|
384
|
+ ) as user_count
|
|
385
|
+ ON DATE_FORMAT(user_count.create_date,'%Y-%m-%d') = temp_date.date
|
|
386
|
+ </select>
|
353
|
387
|
|
354
|
388
|
</mapper>
|