|
@@ -126,10 +126,10 @@
|
126
|
126
|
and t.tagert_type = #{targetType}
|
127
|
127
|
</if>
|
128
|
128
|
<if test="startDate != null ">
|
129
|
|
- and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
129
|
+ and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
130
|
130
|
</if>
|
131
|
131
|
<if test="endDate != null ">
|
132
|
|
- and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
132
|
+ and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
133
|
133
|
</if>
|
134
|
134
|
<if test="startDate == null or endDate == null ">
|
135
|
135
|
AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -182,10 +182,10 @@
|
182
|
182
|
and t.tagert_type = #{targetType}
|
183
|
183
|
</if>
|
184
|
184
|
<if test="startDate != null ">
|
185
|
|
- and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
185
|
+ and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
186
|
186
|
</if>
|
187
|
187
|
<if test="endDate != null ">
|
188
|
|
- and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
188
|
+ and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
189
|
189
|
</if>
|
190
|
190
|
<if test="startDate == null or endDate == null ">
|
191
|
191
|
AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -232,10 +232,10 @@
|
232
|
232
|
and t.target_type = #{targetType}
|
233
|
233
|
</if>
|
234
|
234
|
<if test="startDate != null">
|
235
|
|
- and t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
235
|
+ and t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
236
|
236
|
</if>
|
237
|
237
|
<if test="endDate != null">
|
238
|
|
- and t.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
238
|
+ and t.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
239
|
239
|
</if>
|
240
|
240
|
<if test="startDate == null or endDate == null ">
|
241
|
241
|
AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -267,31 +267,33 @@
|
267
|
267
|
</trim>
|
268
|
268
|
) AS temp_date
|
269
|
269
|
LEFT JOIN (
|
270
|
|
- SELECT
|
271
|
|
- COUNT( 1 ) AS user_count,
|
272
|
|
- t.visit_time AS create_date
|
273
|
|
- FROM
|
274
|
|
- ta_person_visit_record t
|
275
|
|
- WHERE
|
276
|
|
- t.`event` = 'detail' and t.event_type in ('activity','help','group','h5') and t.org_id = #{orgId}
|
277
|
|
- <if test="buildingId != null and buildingId != ''">
|
278
|
|
- and t.building_id = #{buildingId}
|
279
|
|
- </if>
|
280
|
|
- <if test="targetType != null and targetType != ''">
|
281
|
|
- and t.target_type = #{targetType}
|
282
|
|
- </if>
|
283
|
|
- <if test="startDate != null">
|
284
|
|
- and t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
285
|
|
- </if>
|
286
|
|
- <if test="endDate != null">
|
287
|
|
- and t.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
288
|
|
- </if>
|
289
|
|
- <if test="startDate == null or endDate == null">
|
290
|
|
- AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
291
|
|
- </if>
|
292
|
|
- GROUP BY
|
293
|
|
- DATE_FORMAT( t.visit_time, '%Y-%m-%d' ) , person_id
|
294
|
|
- ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
|
|
270
|
+ select count(*) AS user_count , visitPersonCount.* from (
|
|
271
|
+ SELECT
|
|
272
|
+ t.visit_time AS create_date,
|
|
273
|
+ t.person_id
|
|
274
|
+ FROM
|
|
275
|
+ ta_person_visit_record t
|
|
276
|
+ WHERE
|
|
277
|
+ t.`event` = 'detail' and t.event_type in ('activity','help','group','h5') and t.org_id = #{orgId}
|
|
278
|
+ <if test="buildingId != null and buildingId != ''">
|
|
279
|
+ and t.building_id = #{buildingId}
|
|
280
|
+ </if>
|
|
281
|
+ <if test="targetType != null and targetType != ''">
|
|
282
|
+ and t.target_type = #{targetType}
|
|
283
|
+ </if>
|
|
284
|
+ <if test="startDate != null">
|
|
285
|
+ and t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
|
286
|
+ </if>
|
|
287
|
+ <if test="endDate != null">
|
|
288
|
+ and t.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
|
289
|
+ </if>
|
|
290
|
+ <if test="startDate == null or endDate == null">
|
|
291
|
+ AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
292
|
+ </if>
|
|
293
|
+ GROUP BY
|
|
294
|
+ DATE_FORMAT(t.visit_time, '%Y-%m-%d'),
|
|
295
|
+ person_id) as visitPersonCount GROUP BY DATE_FORMAT(visitPersonCount.create_date, '%Y-%m-%d')
|
|
296
|
+ ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date, '%Y-%m-%d' )
|
295
|
297
|
) AS visit_person_count_table
|
296
|
298
|
group by date order by date
|
297
|
299
|
</select>
|
|
@@ -331,10 +333,10 @@
|
331
|
333
|
and t.target_type = #{targetType}
|
332
|
334
|
</if>
|
333
|
335
|
<if test="startDate != null ">
|
334
|
|
- and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
336
|
+ and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
335
|
337
|
</if>
|
336
|
338
|
<if test="endDate != null ">
|
337
|
|
- and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
339
|
+ and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
338
|
340
|
</if>
|
339
|
341
|
<if test="startDate == null or endDate == null">
|
340
|
342
|
AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -382,10 +384,10 @@
|
382
|
384
|
and t.tagert_type = #{targetType}
|
383
|
385
|
</if>
|
384
|
386
|
<if test="startDate != null ">
|
385
|
|
- and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
387
|
+ and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
386
|
388
|
</if>
|
387
|
389
|
<if test="endDate != null ">
|
388
|
|
- and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
390
|
+ and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
389
|
391
|
</if>
|
390
|
392
|
<if test="startDate == null or endDate == null ">
|
391
|
393
|
AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -413,15 +415,15 @@
|
413
|
415
|
and t.tagert_type = #{targetType}
|
414
|
416
|
</if>
|
415
|
417
|
<if test="startDate != null ">
|
416
|
|
- and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
418
|
+ and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
417
|
419
|
</if>
|
418
|
420
|
<if test="endDate != null ">
|
419
|
|
- and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
421
|
+ and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
420
|
422
|
</if>
|
421
|
423
|
<if test="startDate == null or endDate == null ">
|
422
|
424
|
AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
423
|
425
|
</if>
|
424
|
|
- GROUP BY t.person_id
|
|
426
|
+ GROUP BY t.person_id, DATE_FORMAT( t.create_date, '%Y-%m-%d' )
|
425
|
427
|
) as temp1
|
426
|
428
|
) AS temp1 ON temp_date.date = DATE_FORMAT( temp1.create_date, '%Y-%m-%d' )
|
427
|
429
|
LEFT JOIN (
|
|
@@ -439,10 +441,10 @@
|
439
|
441
|
and t.target_type = #{targetType}
|
440
|
442
|
</if>
|
441
|
443
|
<if test="startDate != null">
|
442
|
|
- and t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
444
|
+ and t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
443
|
445
|
</if>
|
444
|
446
|
<if test="endDate != null">
|
445
|
|
- and t.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
447
|
+ and t.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
446
|
448
|
</if>
|
447
|
449
|
<if test="startDate == null or endDate == null ">
|
448
|
450
|
AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -466,10 +468,10 @@
|
466
|
468
|
and t.target_type = #{targetType}
|
467
|
469
|
</if>
|
468
|
470
|
<if test="startDate != null">
|
469
|
|
- and t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
471
|
+ and t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
470
|
472
|
</if>
|
471
|
473
|
<if test="endDate != null">
|
472
|
|
- and t.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
474
|
+ and t.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
473
|
475
|
</if>
|
474
|
476
|
<if test="startDate == null or endDate == null">
|
475
|
477
|
AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -495,10 +497,10 @@
|
495
|
497
|
and t.target_type = #{targetType}
|
496
|
498
|
</if>
|
497
|
499
|
<if test="startDate != null ">
|
498
|
|
- and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
500
|
+ and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
499
|
501
|
</if>
|
500
|
502
|
<if test="endDate != null ">
|
501
|
|
- and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
503
|
+ and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
502
|
504
|
</if>
|
503
|
505
|
<if test="startDate == null or endDate == null">
|
504
|
506
|
AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -513,7 +515,6 @@
|
513
|
515
|
<if test="colKey != null and colKey != ''">
|
514
|
516
|
ORDER BY ${colKey} ${sortType}
|
515
|
517
|
</if>
|
516
|
|
-
|
517
|
518
|
</select>
|
518
|
519
|
<select id="selectExportTableData" resultType="com.huiju.estateagents.excel.ActivityStatistics.StatisicAttractUser">
|
519
|
520
|
SELECT date, ifnull(shareNum ,0) as shareNum, ifnull(sharePersonNum, 0) as sharePersonNum, ifnull(visitNum, 0) as visitNum, ifnull(visitPersonNum, 0) as visitPersonNum, ifnull(addRegistNum,0) as addRegistNum
|
|
@@ -550,10 +551,10 @@
|
550
|
551
|
and t.tagert_type = #{targetType}
|
551
|
552
|
</if>
|
552
|
553
|
<if test="startDate != null ">
|
553
|
|
- and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
554
|
+ and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
554
|
555
|
</if>
|
555
|
556
|
<if test="endDate != null ">
|
556
|
|
- and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
557
|
+ and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
557
|
558
|
</if>
|
558
|
559
|
<if test="startDate == null or endDate == null ">
|
559
|
560
|
AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -581,15 +582,15 @@
|
581
|
582
|
and t.tagert_type = #{targetType}
|
582
|
583
|
</if>
|
583
|
584
|
<if test="startDate != null ">
|
584
|
|
- and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
585
|
+ and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
585
|
586
|
</if>
|
586
|
587
|
<if test="endDate != null ">
|
587
|
|
- and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
588
|
+ and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
588
|
589
|
</if>
|
589
|
590
|
<if test="startDate == null or endDate == null ">
|
590
|
591
|
AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
591
|
592
|
</if>
|
592
|
|
- GROUP BY t.person_id
|
|
593
|
+ GROUP BY t.person_id, DATE_FORMAT( t.create_date, '%Y-%m-%d' )
|
593
|
594
|
) as temp1
|
594
|
595
|
) AS temp1 ON temp_date.date = DATE_FORMAT( temp1.create_date, '%Y-%m-%d' )
|
595
|
596
|
LEFT JOIN (
|
|
@@ -607,10 +608,10 @@
|
607
|
608
|
and t.target_type = #{targetType}
|
608
|
609
|
</if>
|
609
|
610
|
<if test="startDate != null">
|
610
|
|
- and t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
611
|
+ and t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
611
|
612
|
</if>
|
612
|
613
|
<if test="endDate != null">
|
613
|
|
- and t.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
614
|
+ and t.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
614
|
615
|
</if>
|
615
|
616
|
<if test="startDate == null or endDate == null ">
|
616
|
617
|
AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -634,10 +635,10 @@
|
634
|
635
|
and t.target_type = #{targetType}
|
635
|
636
|
</if>
|
636
|
637
|
<if test="startDate != null">
|
637
|
|
- and t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
638
|
+ and t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
638
|
639
|
</if>
|
639
|
640
|
<if test="endDate != null">
|
640
|
|
- and t.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
641
|
+ and t.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
641
|
642
|
</if>
|
642
|
643
|
<if test="startDate == null or endDate == null">
|
643
|
644
|
AND t.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -663,10 +664,10 @@
|
663
|
664
|
and t.target_type = #{targetType}
|
664
|
665
|
</if>
|
665
|
666
|
<if test="startDate != null ">
|
666
|
|
- and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
667
|
+ and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
667
|
668
|
</if>
|
668
|
669
|
<if test="endDate != null ">
|
669
|
|
- and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
670
|
+ and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
670
|
671
|
</if>
|
671
|
672
|
<if test="startDate == null or endDate == null">
|
672
|
673
|
AND t.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -746,10 +747,10 @@
|
746
|
747
|
and a.tagert_type = #{targetType}
|
747
|
748
|
</if>
|
748
|
749
|
<if test="startDate != null ">
|
749
|
|
- and a.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
750
|
+ and a.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
750
|
751
|
</if>
|
751
|
752
|
<if test="endDate != null ">
|
752
|
|
- and a.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
753
|
+ and a.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
753
|
754
|
</if>
|
754
|
755
|
<if test="startDate == null or endDate == null ">
|
755
|
756
|
AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -765,10 +766,10 @@
|
765
|
766
|
and a.tagert_type = #{targetType}
|
766
|
767
|
</if>
|
767
|
768
|
<if test="startDate != null ">
|
768
|
|
- and a.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
769
|
+ and a.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
769
|
770
|
</if>
|
770
|
771
|
<if test="endDate != null ">
|
771
|
|
- and a.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
772
|
+ and a.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
772
|
773
|
</if>
|
773
|
774
|
<if test="startDate == null or endDate == null ">
|
774
|
775
|
AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -781,13 +782,13 @@
|
781
|
782
|
select * from (
|
782
|
783
|
select count(*) as visitNum, a.target_id, a.event_type From ta_person_visit_record a where a.event_type in ('activity','group','h5','help') and a.`event` = 'detail' and a.org_id = #{orgId}
|
783
|
784
|
<if test="targetType != null and targetType != ''">
|
784
|
|
- and a.target_type = #{targetType}
|
|
785
|
+ and (case when #{targetType} = 'activity' then a.target_type = 'dynamic' else a.target_type = #{targetType} end)
|
785
|
786
|
</if>
|
786
|
787
|
<if test="startDate != null">
|
787
|
|
- and a.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
788
|
+ and a.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
788
|
789
|
</if>
|
789
|
790
|
<if test="endDate != null">
|
790
|
|
- and a.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
791
|
+ and a.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
791
|
792
|
</if>
|
792
|
793
|
<if test="startDate == null or endDate == null ">
|
793
|
794
|
AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -800,13 +801,13 @@
|
800
|
801
|
select count(*) as visitPersonNum ,visitPersonNum.target_id, visitPersonNum.event_type from (
|
801
|
802
|
select a.* From ta_person_visit_record a where a.event_type in ('activity','group','h5','help') and a.`event` = 'detail' and a.org_id = #{orgId}
|
802
|
803
|
<if test="targetType != null and targetType != ''">
|
803
|
|
- and a.target_type = #{targetType}
|
|
804
|
+ and (case when #{targetType} = 'activity' then a.target_type = 'dynamic' else a.target_type = #{targetType} end)
|
804
|
805
|
</if>
|
805
|
806
|
<if test="startDate != null">
|
806
|
|
- and a.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
807
|
+ and a.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
807
|
808
|
</if>
|
808
|
809
|
<if test="endDate != null">
|
809
|
|
- and a.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
810
|
+ and a.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
810
|
811
|
</if>
|
811
|
812
|
<if test="startDate == null or endDate == null ">
|
812
|
813
|
AND a.visit_time BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -823,10 +824,10 @@
|
823
|
824
|
and a.target_type = #{targetType}
|
824
|
825
|
</if>
|
825
|
826
|
<if test="startDate != null ">
|
826
|
|
- and a.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
827
|
+ and a.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
827
|
828
|
</if>
|
828
|
829
|
<if test="endDate != null ">
|
829
|
|
- and a.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
830
|
+ and a.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S' )
|
830
|
831
|
</if>
|
831
|
832
|
<if test="startDate == null or endDate == null">
|
832
|
833
|
AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
@@ -1000,7 +1001,9 @@
|
1000
|
1001
|
ifnull(shareNum, 0) as shareNum,
|
1001
|
1002
|
ifnull(visitNum, 0) as visitNum,
|
1002
|
1003
|
ifnull(visitPersonNum, 0) as visitPersonNum,
|
1003
|
|
- person.person_type as sharePersonType from (
|
|
1004
|
+ person.person_type as sharePersonType,
|
|
1005
|
+ person.person_id
|
|
1006
|
+ from (
|
1004
|
1007
|
SELECT t.*, f.nickname, f.tel, f.person_type
|
1005
|
1008
|
FROM ta_share_count t
|
1006
|
1009
|
LEFT JOIN ta_help_activity a
|
|
@@ -1059,6 +1062,10 @@
|
1059
|
1062
|
|
1060
|
1063
|
left join (
|
1061
|
1064
|
select count(1) as visitNum, t.share_person as person_id From ta_share_person_from t
|
|
1065
|
+ left join
|
|
1066
|
+ (
|
|
1067
|
+ select a.person_id, b.user_id From ta_person a left join ta_user b on a.user_id = b.user_id where a.org_id = #{orgId}
|
|
1068
|
+ ) as a on t.share_person = a.person_id or t.share_person = a.user_id
|
1062
|
1069
|
where t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
|
1063
|
1070
|
and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') group by t.share_person
|
1064
|
1071
|
) as visitNum on visitNum.person_id = person.person_id
|
|
@@ -1066,6 +1073,10 @@
|
1066
|
1073
|
left join (
|
1067
|
1074
|
select count(1) as visitPersonNum, visitNum.share_person as person_id From (
|
1068
|
1075
|
select count(1), t.share_person From ta_share_person_from t
|
|
1076
|
+ left join
|
|
1077
|
+ (
|
|
1078
|
+ select a.person_id, b.user_id From ta_person a left join ta_user b on a.user_id = b.user_id where a.org_id = #{orgId}
|
|
1079
|
+ ) as a on t.share_person = a.person_id or t.share_person = a.user_id
|
1069
|
1080
|
where t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
|
1070
|
1081
|
and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share')
|
1071
|
1082
|
group by t.person_id, t.share_person
|
|
@@ -1138,17 +1149,25 @@
|
1138
|
1149
|
|
1139
|
1150
|
left join (
|
1140
|
1151
|
select count(1) as visitNum, t.share_person as person_id From ta_share_person_from t
|
|
1152
|
+ left join
|
|
1153
|
+ (
|
|
1154
|
+ select a.person_id, b.user_id From ta_person a left join ta_user b on a.user_id = b.user_id where a.org_id = #{orgId}
|
|
1155
|
+ ) as a on t.share_person = a.person_id or t.share_person = a.user_id
|
1141
|
1156
|
where t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
|
1142
|
1157
|
and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') group by t.share_person
|
1143
|
1158
|
) as visitNum on visitNum.person_id = person.person_id
|
1144
|
1159
|
|
1145
|
1160
|
left join (
|
1146
|
|
- select count(1) as visitPersonNum, visitNum.share_person as person_id From (
|
1147
|
|
- select count(1), t.share_person From ta_share_person_from t
|
1148
|
|
- where t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
|
1149
|
|
- and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share')
|
1150
|
|
- group by t.person_id, t.share_person
|
1151
|
|
- ) as visitNum group by visitNum.share_person
|
|
1161
|
+ select count(1) as visitPersonNum, visitNum.share_person as person_id From (
|
|
1162
|
+ select count(1), t.share_person From ta_share_person_from t
|
|
1163
|
+ left join
|
|
1164
|
+ (
|
|
1165
|
+ select a.person_id, b.user_id From ta_person a left join ta_user b on a.user_id = b.user_id where a.org_id = #{orgId}
|
|
1166
|
+ ) as a on t.share_person = a.person_id or t.share_person = a.user_id
|
|
1167
|
+ where t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
|
|
1168
|
+ and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share')
|
|
1169
|
+ group by t.person_id, t.share_person
|
|
1170
|
+ ) as visitNum group by visitNum.share_person
|
1152
|
1171
|
) as visitPersonNum on visitPersonNum.person_id = person.person_id
|
1153
|
1172
|
<if test="colKey == null or colKey == ''">
|
1154
|
1173
|
order by person.create_date desc
|
|
@@ -1189,11 +1208,23 @@
|
1189
|
1208
|
and t.org_id = #{orgId}
|
1190
|
1209
|
and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' )
|
1191
|
1210
|
and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
|
|
1211
|
+ <if test="personId != null and personId != ''">
|
|
1212
|
+ and t.person_id = #{personId}
|
|
1213
|
+ </if>
|
1192
|
1214
|
) as person
|
1193
|
1215
|
LEFT JOIN (
|
1194
|
1216
|
SELECT count(*) as visitPersonNum,t.share_person as person_id
|
1195
|
1217
|
FROM ta_share_person_from t
|
1196
|
|
- where t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id = #{orgId} group by t.person_id
|
|
1218
|
+ where t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share') and t.org_id = #{orgId}
|
|
1219
|
+ <if test="personId != null and personId != ''">
|
|
1220
|
+ and t.share_person = #{personId}
|
|
1221
|
+ </if>
|
|
1222
|
+ <if test="startDate != null ">
|
|
1223
|
+ and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' )
|
|
1224
|
+ </if>
|
|
1225
|
+ <if test="endDate != null ">
|
|
1226
|
+ and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d' )
|
|
1227
|
+ </if>
|
1197
|
1228
|
) as visitPersonNum
|
1198
|
1229
|
ON visitPersonNum.person_id = person.person_id order by person.create_date desc
|
1199
|
1230
|
</select>
|
|
@@ -1427,7 +1458,7 @@
|
1427
|
1458
|
'group',
|
1428
|
1459
|
'h5'
|
1429
|
1460
|
)
|
1430
|
|
- AND t.org_id = 84
|
|
1461
|
+ AND t.org_id = #{orgId}
|
1431
|
1462
|
AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
|
1432
|
1463
|
AND t.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
|
1433
|
1464
|
<if test="activityId != null and activityId != ''">
|
|
@@ -1488,7 +1519,7 @@
|
1488
|
1519
|
'group',
|
1489
|
1520
|
'h5'
|
1490
|
1521
|
)
|
1491
|
|
- AND t.org_id = 84
|
|
1522
|
+ AND t.org_id = #{orgId}
|
1492
|
1523
|
AND t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
|
1493
|
1524
|
AND t.visit_time <= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
|
1494
|
1525
|
GROUP BY
|
|
@@ -1516,5 +1547,66 @@
|
1516
|
1547
|
</where>
|
1517
|
1548
|
order by t.create_date desc
|
1518
|
1549
|
</select>
|
|
1550
|
+ <select id="selectActivityVisitPersonNumByPersonId" resultType="com.huiju.estateagents.excel.ActivityStatistics.VisitPersonNum">
|
|
1551
|
+ select
|
|
1552
|
+ a.nickname, a.phone,
|
|
1553
|
+ if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
|
|
1554
|
+ a.province,
|
|
1555
|
+ b1.scene_name as personFrom,
|
|
1556
|
+ d.name as realtyConsultant,
|
|
1557
|
+ d.phone as realtyConsultantPhone,
|
|
1558
|
+ t.create_date as visitDate,
|
|
1559
|
+ t.visitNum
|
|
1560
|
+ From (
|
|
1561
|
+ SELECT count(1) as visitNum, t.person_id, t.create_date
|
|
1562
|
+ FROM ta_share_person_from t
|
|
1563
|
+ LEFT JOIN (
|
|
1564
|
+ SELECT a.person_id, b.user_id
|
|
1565
|
+ FROM ta_person a
|
|
1566
|
+ LEFT JOIN ta_user b
|
|
1567
|
+ ON a.user_id = b.user_id
|
|
1568
|
+ WHERE a.org_id = #{orgId} ) as a ON t.share_person = a.person_id or t.share_person = a.user_id
|
|
1569
|
+ WHERE t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' ) and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share')
|
|
1570
|
+ and t.share_person = #{personId} group by t.person_id
|
|
1571
|
+ ) as t
|
|
1572
|
+
|
|
1573
|
+ left join ta_person a on t.person_id = a.person_id
|
|
1574
|
+ left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId}
|
|
1575
|
+ left join td_wx_dict b1 on b.scene_id = b1.scene_id
|
|
1576
|
+ left join (
|
|
1577
|
+ select d.person_id, d.`name`, d.phone From ta_recommend_customer c
|
|
1578
|
+ left join ta_person d on c.recommend_person = d.person_id where c.org_id = #{orgId} group by d.person_id
|
|
1579
|
+ ) as d on t.person_id = d.person_id
|
|
1580
|
+ </select>
|
|
1581
|
+
|
|
1582
|
+ <select id="selectActivityVisitNumByPersonId" resultType="com.huiju.estateagents.excel.ActivityStatistics.VisitNum">
|
|
1583
|
+ select
|
|
1584
|
+ a.nickname, a.phone,
|
|
1585
|
+ if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
|
|
1586
|
+ a.province,
|
|
1587
|
+ b1.scene_name as personFrom,
|
|
1588
|
+ d.name as realtyConsultant,
|
|
1589
|
+ d.phone as realtyConsultantPhone,
|
|
1590
|
+ t.create_date as visitDate
|
|
1591
|
+ From (
|
|
1592
|
+ SELECT t.person_id, t.create_date
|
|
1593
|
+ FROM ta_share_person_from t
|
|
1594
|
+ LEFT JOIN (
|
|
1595
|
+ SELECT a.person_id, b.user_id
|
|
1596
|
+ FROM ta_person a
|
|
1597
|
+ LEFT JOIN ta_user b
|
|
1598
|
+ ON a.user_id = b.user_id
|
|
1599
|
+ WHERE a.org_id = #{orgId} ) as a ON t.share_person = a.person_id or t.share_person = a.user_id
|
|
1600
|
+ WHERE t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' ) and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share')
|
|
1601
|
+ and t.share_person = #{personId}
|
|
1602
|
+ ) as t
|
1519
|
1603
|
|
|
1604
|
+ left join ta_person a on t.person_id = a.person_id
|
|
1605
|
+ left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId}
|
|
1606
|
+ left join td_wx_dict b1 on b.scene_id = b1.scene_id
|
|
1607
|
+ left join (
|
|
1608
|
+ select d.person_id, d.`name`, d.phone From ta_recommend_customer c
|
|
1609
|
+ left join ta_person d on c.recommend_person = d.person_id where c.org_id = #{orgId} group by d.person_id
|
|
1610
|
+ ) as d on t.person_id = d.person_id
|
|
1611
|
+ </select>
|
1520
|
1612
|
</mapper>
|