|
@@ -35,17 +35,17 @@
|
35
|
35
|
AND
|
36
|
36
|
(a.building_id in
|
37
|
37
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
38
|
|
- #{taPersonBuildings.buildingId}
|
|
38
|
+ #{taPersonBuilding.buildingId}
|
39
|
39
|
</foreach>
|
40
|
40
|
or
|
41
|
41
|
b.building_id in
|
42
|
42
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
43
|
|
- #{taPersonBuildings.buildingId}
|
|
43
|
+ #{taPersonBuilding.buildingId}
|
44
|
44
|
</foreach>
|
45
|
45
|
or
|
46
|
46
|
e.building_id in
|
47
|
47
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
48
|
|
- #{taPersonBuildings.buildingId}
|
|
48
|
+ #{taPersonBuilding.buildingId}
|
49
|
49
|
</foreach>
|
50
|
50
|
or d.create_user = #{userId}
|
51
|
51
|
or c.create_user = #{userId}
|
|
@@ -88,17 +88,17 @@
|
88
|
88
|
AND
|
89
|
89
|
(a.building_id in
|
90
|
90
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
91
|
|
- #{taPersonBuildings.buildingId}
|
|
91
|
+ #{taPersonBuilding.buildingId}
|
92
|
92
|
</foreach>
|
93
|
93
|
or
|
94
|
94
|
b.building_id in
|
95
|
95
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
96
|
|
- #{taPersonBuildings.buildingId}
|
|
96
|
+ #{taPersonBuilding.buildingId}
|
97
|
97
|
</foreach>
|
98
|
98
|
or
|
99
|
99
|
e.building_id in
|
100
|
100
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
101
|
|
- #{taPersonBuildings.buildingId}
|
|
101
|
+ #{taPersonBuilding.buildingId}
|
102
|
102
|
</foreach>
|
103
|
103
|
or d.create_user = #{userId}
|
104
|
104
|
or c.create_user = #{userId}
|
|
@@ -208,17 +208,17 @@
|
208
|
208
|
AND
|
209
|
209
|
(a.building_id in
|
210
|
210
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
211
|
|
- #{taPersonBuildings.buildingId}
|
|
211
|
+ #{taPersonBuilding.buildingId}
|
212
|
212
|
</foreach>
|
213
|
213
|
or
|
214
|
214
|
b.building_id in
|
215
|
215
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
216
|
|
- #{taPersonBuildings.buildingId}
|
|
216
|
+ #{taPersonBuilding.buildingId}
|
217
|
217
|
</foreach>
|
218
|
218
|
or
|
219
|
219
|
e.building_id in
|
220
|
220
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
221
|
|
- #{taPersonBuildings.buildingId}
|
|
221
|
+ #{taPersonBuilding.buildingId}
|
222
|
222
|
</foreach>
|
223
|
223
|
or d.create_user = #{userId}
|
224
|
224
|
or c.create_user = #{userId}
|
|
@@ -286,17 +286,17 @@
|
286
|
286
|
AND
|
287
|
287
|
(a.building_id in
|
288
|
288
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
289
|
|
- #{taPersonBuildings.buildingId}
|
|
289
|
+ #{taPersonBuilding.buildingId}
|
290
|
290
|
</foreach>
|
291
|
291
|
or
|
292
|
292
|
b.building_id in
|
293
|
293
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
294
|
|
- #{taPersonBuildings.buildingId}
|
|
294
|
+ #{taPersonBuilding.buildingId}
|
295
|
295
|
</foreach>
|
296
|
296
|
or
|
297
|
297
|
e.building_id in
|
298
|
298
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
299
|
|
- #{taPersonBuildings.buildingId}
|
|
299
|
+ #{taPersonBuilding.buildingId}
|
300
|
300
|
</foreach>
|
301
|
301
|
or d.create_user = #{userId}
|
302
|
302
|
or c.create_user = #{userId}
|
|
@@ -519,17 +519,17 @@
|
519
|
519
|
AND
|
520
|
520
|
(a.building_id in
|
521
|
521
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
522
|
|
- #{taPersonBuildings.buildingId}
|
|
522
|
+ #{taPersonBuilding.buildingId}
|
523
|
523
|
</foreach>
|
524
|
524
|
or
|
525
|
525
|
b.building_id in
|
526
|
526
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
527
|
|
- #{taPersonBuildings.buildingId}
|
|
527
|
+ #{taPersonBuilding.buildingId}
|
528
|
528
|
</foreach>
|
529
|
529
|
or
|
530
|
530
|
e.building_id in
|
531
|
531
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
532
|
|
- #{taPersonBuildings.buildingId}
|
|
532
|
+ #{taPersonBuilding.buildingId}
|
533
|
533
|
</foreach>
|
534
|
534
|
or d.create_user = #{userId}
|
535
|
535
|
or c.create_user = #{userId}
|
|
@@ -571,17 +571,17 @@
|
571
|
571
|
AND
|
572
|
572
|
(a.building_id in
|
573
|
573
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
574
|
|
- #{taPersonBuildings.buildingId}
|
|
574
|
+ #{taPersonBuilding.buildingId}
|
575
|
575
|
</foreach>
|
576
|
576
|
or
|
577
|
577
|
b.building_id in
|
578
|
578
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
579
|
|
- #{taPersonBuildings.buildingId}
|
|
579
|
+ #{taPersonBuilding.buildingId}
|
580
|
580
|
</foreach>
|
581
|
581
|
or
|
582
|
582
|
e.building_id in
|
583
|
583
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
584
|
|
- #{taPersonBuildings.buildingId}
|
|
584
|
+ #{taPersonBuilding.buildingId}
|
585
|
585
|
</foreach>
|
586
|
586
|
or d.create_user = #{userId}
|
587
|
587
|
or c.create_user = #{userId}
|
|
@@ -732,17 +732,17 @@
|
732
|
732
|
AND
|
733
|
733
|
(a.building_id in
|
734
|
734
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
735
|
|
- #{taPersonBuildings.buildingId}
|
|
735
|
+ #{taPersonBuilding.buildingId}
|
736
|
736
|
</foreach>
|
737
|
737
|
or
|
738
|
738
|
b.building_id in
|
739
|
739
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
740
|
|
- #{taPersonBuildings.buildingId}
|
|
740
|
+ #{taPersonBuilding.buildingId}
|
741
|
741
|
</foreach>
|
742
|
742
|
or
|
743
|
743
|
e.building_id in
|
744
|
744
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
745
|
|
- #{taPersonBuildings.buildingId}
|
|
745
|
+ #{taPersonBuilding.buildingId}
|
746
|
746
|
</foreach>
|
747
|
747
|
or d.create_user = #{userId}
|
748
|
748
|
or c.create_user = #{userId}
|
|
@@ -784,17 +784,17 @@
|
784
|
784
|
AND
|
785
|
785
|
(a.building_id in
|
786
|
786
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
787
|
|
- #{taPersonBuildings.buildingId}
|
|
787
|
+ #{taPersonBuilding.buildingId}
|
788
|
788
|
</foreach>
|
789
|
789
|
or
|
790
|
790
|
b.building_id in
|
791
|
791
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
792
|
|
- #{taPersonBuildings.buildingId}
|
|
792
|
+ #{taPersonBuilding.buildingId}
|
793
|
793
|
</foreach>
|
794
|
794
|
or
|
795
|
795
|
e.building_id in
|
796
|
796
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
797
|
|
- #{taPersonBuildings.buildingId}
|
|
797
|
+ #{taPersonBuilding.buildingId}
|
798
|
798
|
</foreach>
|
799
|
799
|
or d.create_user = #{userId}
|
800
|
800
|
or c.create_user = #{userId}
|
|
@@ -917,7 +917,7 @@
|
917
|
917
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
918
|
918
|
and a.building_id in
|
919
|
919
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
920
|
|
- #{taPersonBuildings.buildingId}
|
|
920
|
+ #{taPersonBuilding.buildingId}
|
921
|
921
|
</foreach>
|
922
|
922
|
</if>
|
923
|
923
|
union all
|
|
@@ -932,7 +932,7 @@
|
932
|
932
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
933
|
933
|
and b.building_id in
|
934
|
934
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
935
|
|
- #{taPersonBuildings.buildingId}
|
|
935
|
+ #{taPersonBuilding.buildingId}
|
936
|
936
|
</foreach>
|
937
|
937
|
</if>
|
938
|
938
|
union all
|
|
@@ -948,7 +948,7 @@
|
948
|
948
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
949
|
949
|
and c.building_id in
|
950
|
950
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
951
|
|
- #{taPersonBuildings.buildingId}
|
|
951
|
+ #{taPersonBuilding.buildingId}
|
952
|
952
|
</foreach>
|
953
|
953
|
</if>
|
954
|
954
|
union all
|
|
@@ -963,7 +963,7 @@
|
963
|
963
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
964
|
964
|
and c.building_id in
|
965
|
965
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
966
|
|
- #{taPersonBuildings.buildingId}
|
|
966
|
+ #{taPersonBuilding.buildingId}
|
967
|
967
|
</foreach>
|
968
|
968
|
</if>
|
969
|
969
|
union all
|
|
@@ -979,7 +979,7 @@
|
979
|
979
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
980
|
980
|
and e.building_id in
|
981
|
981
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
982
|
|
- #{taPersonBuildings.buildingId}
|
|
982
|
+ #{taPersonBuilding.buildingId}
|
983
|
983
|
</foreach>
|
984
|
984
|
</if>
|
985
|
985
|
) as activity
|
|
@@ -1129,7 +1129,7 @@
|
1129
|
1129
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
1130
|
1130
|
and a.building_id in
|
1131
|
1131
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1132
|
|
- #{taPersonBuildings.buildingId}
|
|
1132
|
+ #{taPersonBuilding.buildingId}
|
1133
|
1133
|
</foreach>
|
1134
|
1134
|
</if>
|
1135
|
1135
|
union all
|
|
@@ -1144,7 +1144,7 @@
|
1144
|
1144
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
1145
|
1145
|
and b.building_id in
|
1146
|
1146
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1147
|
|
- #{taPersonBuildings.buildingId}
|
|
1147
|
+ #{taPersonBuilding.buildingId}
|
1148
|
1148
|
</foreach>
|
1149
|
1149
|
</if>
|
1150
|
1150
|
union all
|
|
@@ -1160,7 +1160,7 @@
|
1160
|
1160
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
1161
|
1161
|
and c.building_id in
|
1162
|
1162
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1163
|
|
- #{taPersonBuildings.buildingId}
|
|
1163
|
+ #{taPersonBuilding.buildingId}
|
1164
|
1164
|
</foreach>
|
1165
|
1165
|
</if>
|
1166
|
1166
|
union all
|
|
@@ -1175,7 +1175,7 @@
|
1175
|
1175
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
1176
|
1176
|
and c.building_id in
|
1177
|
1177
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1178
|
|
- #{taPersonBuildings.buildingId}
|
|
1178
|
+ #{taPersonBuilding.buildingId}
|
1179
|
1179
|
</foreach>
|
1180
|
1180
|
</if>
|
1181
|
1181
|
union all
|
|
@@ -1191,7 +1191,7 @@
|
1191
|
1191
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
1192
|
1192
|
and e.building_id in
|
1193
|
1193
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1194
|
|
- #{taPersonBuildings.buildingId}
|
|
1194
|
+ #{taPersonBuilding.buildingId}
|
1195
|
1195
|
</foreach>
|
1196
|
1196
|
</if>
|
1197
|
1197
|
) as activity
|
|
@@ -1333,17 +1333,17 @@
|
1333
|
1333
|
AND
|
1334
|
1334
|
(a.building_id in
|
1335
|
1335
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1336
|
|
- #{taPersonBuildings.buildingId}
|
|
1336
|
+ #{taPersonBuilding.buildingId}
|
1337
|
1337
|
</foreach>
|
1338
|
1338
|
or
|
1339
|
1339
|
b.building_id in
|
1340
|
1340
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1341
|
|
- #{taPersonBuildings.buildingId}
|
|
1341
|
+ #{taPersonBuilding.buildingId}
|
1342
|
1342
|
</foreach>
|
1343
|
1343
|
or
|
1344
|
1344
|
e.building_id in
|
1345
|
1345
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1346
|
|
- #{taPersonBuildings.buildingId}
|
|
1346
|
+ #{taPersonBuilding.buildingId}
|
1347
|
1347
|
</foreach>
|
1348
|
1348
|
or d.create_user = #{userId}
|
1349
|
1349
|
or c.create_user = #{userId}
|
|
@@ -1399,6 +1399,12 @@
|
1399
|
1399
|
WHERE t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S') AND t.create_date <=
|
1400
|
1400
|
DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S') AND t.target_type IN ('dynamic_share', 'h5_share', 'help_share',
|
1401
|
1401
|
'live_share', 'group_share')
|
|
1402
|
+ <if test="activityId != null and activityId != ''">
|
|
1403
|
+ and t.target_id = #{activityId}
|
|
1404
|
+ </if>
|
|
1405
|
+ <if test="activityType != null and activityType != ''">
|
|
1406
|
+ and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
|
|
1407
|
+ </if>
|
1402
|
1408
|
and t.org_id = #{orgId} group by t.share_person ) t
|
1403
|
1409
|
left join ta_person a on t.share_person = a.person_id
|
1404
|
1410
|
left join ta_person b on t.share_person = b.user_id
|
|
@@ -1412,6 +1418,12 @@
|
1412
|
1418
|
FROM ta_share_person_from t
|
1413
|
1419
|
WHERE t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date <=
|
1414
|
1420
|
DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
|
|
1421
|
+ <if test="activityId != null and activityId != ''">
|
|
1422
|
+ and t.target_id = #{activityId}
|
|
1423
|
+ </if>
|
|
1424
|
+ <if test="activityType != null and activityType != ''">
|
|
1425
|
+ and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
|
|
1426
|
+ </if>
|
1415
|
1427
|
and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share')
|
1416
|
1428
|
and t.org_id = #{orgId} group by t.share_person ) t
|
1417
|
1429
|
left join ta_person a on t.share_person = a.person_id
|
|
@@ -1432,14 +1444,7 @@
|
1432
|
1444
|
ifnull(shareNum, 0) as shareNum,
|
1433
|
1445
|
ifnull(visitNum, 0) as visitNum,
|
1434
|
1446
|
ifnull(visitPersonNum, 0) as visitPersonNum,
|
1435
|
|
- CASE
|
1436
|
|
- WHEN person.person_type = 'drift' THEN
|
1437
|
|
- "游客"
|
1438
|
|
- WHEN person.person_type = 'customer' THEN
|
1439
|
|
- "普通客户"
|
1440
|
|
- WHEN person.person_type = 'Realty Consultant' THEN
|
1441
|
|
- "置业顾问"
|
1442
|
|
- END `sharePersonType`,
|
|
1447
|
+ person.person_type as sharePersonType,
|
1443
|
1448
|
person.person_id
|
1444
|
1449
|
from (
|
1445
|
1450
|
SELECT t.*, f.nickname, f.phone, f.person_type
|
|
@@ -1449,7 +1454,8 @@
|
1449
|
1454
|
LEFT JOIN ta_live_activity c ON t.be_share = c.live_activity_id
|
1450
|
1455
|
LEFT JOIN ta_drainage d ON t.be_share = d.drainage_id
|
1451
|
1456
|
LEFT JOIN ta_building_dynamic e ON t.be_share = e.dynamic_id
|
1452
|
|
- LEFT JOIN ta_person f ON t.person_id = f.person_id
|
|
1457
|
+ LEFT JOIN ta_person f
|
|
1458
|
+ ON t.person_id = f.person_id
|
1453
|
1459
|
WHERE t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and t.org_id = #{orgId}
|
1454
|
1460
|
and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date <=
|
1455
|
1461
|
DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
|
|
@@ -1462,41 +1468,41 @@
|
1462
|
1468
|
or e.building_id = #{buildingId}
|
1463
|
1469
|
)
|
1464
|
1470
|
</if>
|
1465
|
|
- <if test="activityId != null and activityId != ''">
|
1466
|
|
- and t.be_share = #{activityId}
|
1467
|
|
- </if>
|
1468
|
|
- <if test="activityType != null and activityType != ''">
|
1469
|
|
- and t.tagert_type = #{activityType}
|
1470
|
|
- </if>
|
1471
|
|
- <if test="sharePersonType != null and sharePersonType != ''">
|
1472
|
|
- and f.person_type = #{sharePersonType}
|
1473
|
|
- </if>
|
1474
|
|
- <if test="sharePersonName != null and sharePersonName != ''">
|
1475
|
|
- and f.nickname like CONCAT('%',#{sharePersonName}, '%')
|
1476
|
|
- </if>
|
1477
|
|
- <if test="sharePhone != null and sharePhone != ''">
|
1478
|
|
- and f.phone like CONCAT('%',#{sharePhone}, '%')
|
1479
|
|
- </if>
|
1480
|
1471
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
1481
|
1472
|
AND
|
1482
|
1473
|
(a.building_id in
|
1483
|
1474
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1484
|
|
- #{taPersonBuildings.buildingId}
|
|
1475
|
+ #{taPersonBuilding.buildingId}
|
1485
|
1476
|
</foreach>
|
1486
|
1477
|
or
|
1487
|
1478
|
b.building_id in
|
1488
|
1479
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1489
|
|
- #{taPersonBuildings.buildingId}
|
|
1480
|
+ #{taPersonBuilding.buildingId}
|
1490
|
1481
|
</foreach>
|
1491
|
1482
|
or
|
1492
|
1483
|
e.building_id in
|
1493
|
1484
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1494
|
|
- #{taPersonBuildings.buildingId}
|
|
1485
|
+ #{taPersonBuilding.buildingId}
|
1495
|
1486
|
</foreach>
|
1496
|
1487
|
or d.create_user = #{userId}
|
1497
|
1488
|
or c.create_user = #{userId}
|
1498
|
1489
|
)
|
1499
|
1490
|
</if>
|
|
1491
|
+ <if test="activityId != null and activityId != ''">
|
|
1492
|
+ and t.be_share = #{activityId}
|
|
1493
|
+ </if>
|
|
1494
|
+ <if test="activityType != null and activityType != ''">
|
|
1495
|
+ and t.tagert_type = #{activityType}
|
|
1496
|
+ </if>
|
|
1497
|
+ <if test="sharePersonType != null and sharePersonType != ''">
|
|
1498
|
+ and f.person_type = #{sharePersonType}
|
|
1499
|
+ </if>
|
|
1500
|
+ <if test="sharePersonName != null and sharePersonName != ''">
|
|
1501
|
+ and f.nickname like CONCAT('%',#{sharePersonName}, '%')
|
|
1502
|
+ </if>
|
|
1503
|
+ <if test="sharePhone != null and sharePhone != ''">
|
|
1504
|
+ and f.phone like CONCAT('%',#{sharePhone}, '%')
|
|
1505
|
+ </if>
|
1500
|
1506
|
GROUP BY t.person_id
|
1501
|
1507
|
) as person
|
1502
|
1508
|
|
|
@@ -1504,16 +1510,11 @@
|
1504
|
1510
|
select * from (
|
1505
|
1511
|
SELECT count(*) as shareNum, t.person_id
|
1506
|
1512
|
FROM ta_share_count t
|
1507
|
|
- LEFT JOIN ta_help_activity a
|
1508
|
|
- ON t.be_share = a.help_activity_id
|
1509
|
|
- LEFT JOIN ta_share_activity b
|
1510
|
|
- ON t.be_share = b.share_id
|
1511
|
|
- LEFT JOIN ta_live_activity c
|
1512
|
|
- ON t.be_share = c.live_activity_id
|
1513
|
|
- LEFT JOIN ta_drainage d
|
1514
|
|
- ON t.be_share = d.drainage_id
|
1515
|
|
- LEFT JOIN ta_building_dynamic e
|
1516
|
|
- ON t.be_share = e.dynamic_id
|
|
1513
|
+ LEFT JOIN ta_help_activity a ON t.be_share = a.help_activity_id
|
|
1514
|
+ LEFT JOIN ta_share_activity b ON t.be_share = b.share_id
|
|
1515
|
+ LEFT JOIN ta_live_activity c ON t.be_share = c.live_activity_id
|
|
1516
|
+ LEFT JOIN ta_drainage d ON t.be_share = d.drainage_id
|
|
1517
|
+ LEFT JOIN ta_building_dynamic e ON t.be_share = e.dynamic_id
|
1517
|
1518
|
LEFT JOIN ta_person f
|
1518
|
1519
|
ON t.person_id = f.person_id
|
1519
|
1520
|
WHERE t.tagert_type in ('activity','group','h5','help','liveApp','livePost') and t.org_id = #{orgId}
|
|
@@ -1529,23 +1530,6 @@
|
1529
|
1530
|
) as temp
|
1530
|
1531
|
) as shareNum on person.person_id = shareNum.person_id
|
1531
|
1532
|
|
1532
|
|
- left join (
|
1533
|
|
-
|
1534
|
|
- select t.visitNum, a.person_id AS person_id From (
|
1535
|
|
- select t.share_person, count(1) as visitNum from ta_share_person_from t WHERE t.create_date >=
|
1536
|
|
- DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S') AND t.create_date <= DATE_FORMAT(#{endDate}, '%Y-%m-%d
|
1537
|
|
- %H:%I:%S') AND t.target_type IN ('dynamic_share', 'h5_share', 'help_share', 'live_share', 'group_share')
|
1538
|
|
- and t.org_id = #{orgId} group by t.share_person
|
1539
|
|
- ) t
|
1540
|
|
- LEFT JOIN (SELECT a.person_id, b.user_id
|
1541
|
|
- FROM ta_person a
|
1542
|
|
- LEFT JOIN ta_user b
|
1543
|
|
- ON a.user_id = b.user_id
|
1544
|
|
- WHERE a.org_id = #{orgId}) AS a
|
1545
|
|
- ON t.share_person = a.person_id OR t.share_person = a.user_id
|
1546
|
|
-
|
1547
|
|
- ) as visitNum on visitNum.person_id = person.person_id
|
1548
|
|
-
|
1549
|
1533
|
left join (
|
1550
|
1534
|
SELECT t.visitNum, ifnull(a.person_id,b.person_id) AS person_id
|
1551
|
1535
|
FROM (
|
|
@@ -1554,6 +1538,12 @@
|
1554
|
1538
|
WHERE t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S') AND t.create_date <=
|
1555
|
1539
|
DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S') AND t.target_type IN ('dynamic_share', 'h5_share', 'help_share',
|
1556
|
1540
|
'live_share', 'group_share')
|
|
1541
|
+ <if test="activityId != null and activityId != ''">
|
|
1542
|
+ and t.target_id = #{activityId}
|
|
1543
|
+ </if>
|
|
1544
|
+ <if test="activityType != null and activityType != ''">
|
|
1545
|
+ and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
|
|
1546
|
+ </if>
|
1557
|
1547
|
and t.org_id = #{orgId} group by t.share_person ) t
|
1558
|
1548
|
left join ta_person a on t.share_person = a.person_id
|
1559
|
1549
|
left join ta_person b on t.share_person = b.user_id
|
|
@@ -1567,18 +1557,24 @@
|
1567
|
1557
|
FROM ta_share_person_from t
|
1568
|
1558
|
WHERE t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date <=
|
1569
|
1559
|
DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
|
|
1560
|
+ <if test="activityId != null and activityId != ''">
|
|
1561
|
+ and t.target_id = #{activityId}
|
|
1562
|
+ </if>
|
|
1563
|
+ <if test="activityType != null and activityType != ''">
|
|
1564
|
+ and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
|
|
1565
|
+ </if>
|
1570
|
1566
|
and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share')
|
1571
|
1567
|
and t.org_id = #{orgId} group by t.share_person ) t
|
1572
|
1568
|
left join ta_person a on t.share_person = a.person_id
|
1573
|
1569
|
left join ta_person b on t.share_person = b.user_id
|
1574
|
1570
|
) as visitPersonNum on visitPersonNum.person_id = person.person_id
|
1575
|
|
-
|
1576
|
1571
|
<if test="colKey == null or colKey == ''">
|
1577
|
1572
|
order by person.create_date desc
|
1578
|
1573
|
</if>
|
1579
|
1574
|
<if test="colKey != null and colKey != ''">
|
1580
|
1575
|
ORDER BY ${colKey} ${sort}
|
1581
|
1576
|
</if>
|
|
1577
|
+
|
1582
|
1578
|
</select>
|
1583
|
1579
|
|
1584
|
1580
|
<select id="selectActivityShareNum" resultType="com.huiju.estateagents.excel.ActivityStatistics.ShareNum">
|
|
@@ -1616,17 +1612,17 @@
|
1616
|
1612
|
AND
|
1617
|
1613
|
(a.building_id in
|
1618
|
1614
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1619
|
|
- #{taPersonBuildings.buildingId}
|
|
1615
|
+ #{taPersonBuilding.buildingId}
|
1620
|
1616
|
</foreach>
|
1621
|
1617
|
or
|
1622
|
1618
|
b.building_id in
|
1623
|
1619
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1624
|
|
- #{taPersonBuildings.buildingId}
|
|
1620
|
+ #{taPersonBuilding.buildingId}
|
1625
|
1621
|
</foreach>
|
1626
|
1622
|
or
|
1627
|
1623
|
e.building_id in
|
1628
|
1624
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1629
|
|
- #{taPersonBuildings.buildingId}
|
|
1625
|
+ #{taPersonBuilding.buildingId}
|
1630
|
1626
|
</foreach>
|
1631
|
1627
|
or d.create_user = #{userId}
|
1632
|
1628
|
or c.create_user = #{userId}
|
|
@@ -1710,17 +1706,17 @@
|
1710
|
1706
|
AND
|
1711
|
1707
|
(a.building_id in
|
1712
|
1708
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1713
|
|
- #{taPersonBuildings.buildingId}
|
|
1709
|
+ #{taPersonBuilding.buildingId}
|
1714
|
1710
|
</foreach>
|
1715
|
1711
|
or
|
1716
|
1712
|
b.building_id in
|
1717
|
1713
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1718
|
|
- #{taPersonBuildings.buildingId}
|
|
1714
|
+ #{taPersonBuilding.buildingId}
|
1719
|
1715
|
</foreach>
|
1720
|
1716
|
or
|
1721
|
1717
|
e.building_id in
|
1722
|
1718
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1723
|
|
- #{taPersonBuildings.buildingId}
|
|
1719
|
+ #{taPersonBuilding.buildingId}
|
1724
|
1720
|
</foreach>
|
1725
|
1721
|
or d.create_user = #{userId}
|
1726
|
1722
|
or c.create_user = #{userId}
|
|
@@ -2113,7 +2109,14 @@
|
2113
|
2109
|
SELECT count(1) as visitNum, t.person_id, t.create_date
|
2114
|
2110
|
FROM ta_share_person_from t
|
2115
|
2111
|
WHERE t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date <=
|
2116
|
|
- DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' ) and t.target_type in
|
|
2112
|
+ DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
|
|
2113
|
+ <if test="activityId != null and activityId != ''">
|
|
2114
|
+ and t.target_id = #{activityId}
|
|
2115
|
+ </if>
|
|
2116
|
+ <if test="activityType != null and activityType != ''">
|
|
2117
|
+ and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
|
|
2118
|
+ </if>
|
|
2119
|
+ and t.target_type in
|
2117
|
2120
|
('dynamic_share','h5_share','help_share','live_share', 'group_share')
|
2118
|
2121
|
and
|
2119
|
2122
|
(t.share_person = (select b.user_id from ta_person t left join ta_user b on t.user_id = b.user_id where t.person_id = #{personId})
|
|
@@ -2154,6 +2157,12 @@
|
2154
|
2157
|
WHERE t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date <=
|
2155
|
2158
|
DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' ) and t.target_type in
|
2156
|
2159
|
('dynamic_share','h5_share','help_share','live_share', 'group_share')
|
|
2160
|
+ <if test="activityId != null and activityId != ''">
|
|
2161
|
+ and t.target_id = #{activityId}
|
|
2162
|
+ </if>
|
|
2163
|
+ <if test="activityType != null and activityType != ''">
|
|
2164
|
+ and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
|
|
2165
|
+ </if>
|
2157
|
2166
|
and
|
2158
|
2167
|
(t.share_person = (select b.user_id from ta_person t left join ta_user b on t.user_id = b.user_id where t.person_id = #{personId})
|
2159
|
2168
|
or t.share_person = #{personId})
|
|
@@ -2187,6 +2196,12 @@
|
2187
|
2196
|
WHERE t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date <=
|
2188
|
2197
|
DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' ) and t.target_type in
|
2189
|
2198
|
('dynamic_share','h5_share','help_share','live_share', 'group_share')
|
|
2199
|
+ <if test="activityId != null and activityId != ''">
|
|
2200
|
+ and t.target_id = #{activityId}
|
|
2201
|
+ </if>
|
|
2202
|
+ <if test="activityType != null and activityType != ''">
|
|
2203
|
+ and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
|
|
2204
|
+ </if>
|
2190
|
2205
|
and
|
2191
|
2206
|
(t.share_person = (select b.user_id from ta_person t left join ta_user b on t.user_id = b.user_id where t.person_id = #{personId})
|
2192
|
2207
|
or t.share_person = #{personId})
|
|
@@ -2225,8 +2240,15 @@
|
2225
|
2240
|
ON a.user_id = b.user_id
|
2226
|
2241
|
WHERE a.org_id = #{orgId} ) as a ON t.share_person = a.person_id or t.share_person = a.user_id
|
2227
|
2242
|
WHERE t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date <=
|
2228
|
|
- DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' ) and t.target_type in
|
|
2243
|
+ DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
|
|
2244
|
+ and t.target_type in
|
2229
|
2245
|
('dynamic_share','h5_share','help_share','live_share', 'group_share')
|
|
2246
|
+ <if test="activityId != null and activityId != ''">
|
|
2247
|
+ and t.target_id = #{activityId}
|
|
2248
|
+ </if>
|
|
2249
|
+ <if test="activityType != null and activityType != ''">
|
|
2250
|
+ and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
|
|
2251
|
+ </if>
|
2230
|
2252
|
and
|
2231
|
2253
|
(t.share_person = (select b.user_id from ta_person t left join ta_user b on t.user_id = b.user_id where t.person_id = #{personId})
|
2232
|
2254
|
or t.share_person = #{personId})
|