|
@@ -857,7 +857,8 @@
|
857
|
857
|
and t.building_id = #{buildingId}
|
858
|
858
|
</if>
|
859
|
859
|
<if test="targetType != null and targetType != ''">
|
860
|
|
- and t.target_type = #{targetType}
|
|
860
|
+ and (case when #{targetType} = 'activity' then t.target_type = 'dynamic' else t.target_type = #{targetType}
|
|
861
|
+ end)
|
861
|
862
|
</if>
|
862
|
863
|
<if test="startDate != null">
|
863
|
864
|
and t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
|
@@ -890,7 +891,8 @@
|
890
|
891
|
and t.building_id = #{buildingId}
|
891
|
892
|
</if>
|
892
|
893
|
<if test="targetType != null and targetType != ''">
|
893
|
|
- and t.target_type = #{targetType}
|
|
894
|
+ and (case when #{targetType} = 'activity' then t.target_type = 'dynamic' else t.target_type = #{targetType}
|
|
895
|
+ end)
|
894
|
896
|
</if>
|
895
|
897
|
<if test="startDate != null">
|
896
|
898
|
and t.visit_time >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
|
@@ -1081,7 +1083,7 @@
|
1081
|
1083
|
<if test="startDate == null or endDate == null ">
|
1082
|
1084
|
AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
1083
|
1085
|
</if>
|
1084
|
|
- group by a.person_id
|
|
1086
|
+ group by a.person_id, be_share
|
1085
|
1087
|
<!-- , be_share, tagert_type-->
|
1086
|
1088
|
) as sharePersonNum group by sharePersonNum.be_share, sharePersonNum.tagert_type
|
1087
|
1089
|
) as sharePersonNum on sharePersonNum.be_share = activity.activityId and sharePersonNum.tagert_type =
|
|
@@ -1179,7 +1181,7 @@
|
1179
|
1181
|
and a.building_id = #{buildingId}
|
1180
|
1182
|
</if>
|
1181
|
1183
|
<if test="activityName != null and activityName != '' ">
|
1182
|
|
- and a.title = #{activityName}
|
|
1184
|
+ and a.title like concat('%', #{activityName}, '%')
|
1183
|
1185
|
</if>
|
1184
|
1186
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
1185
|
1187
|
and a.building_id in
|
|
@@ -1194,7 +1196,7 @@
|
1194
|
1196
|
and b.building_id = #{buildingId}
|
1195
|
1197
|
</if>
|
1196
|
1198
|
<if test="activityName != null and activityName != '' ">
|
1197
|
|
- and b.title = #{activityName}
|
|
1199
|
+ and b.title like concat('%', #{activityName}, '%')
|
1198
|
1200
|
</if>
|
1199
|
1201
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
1200
|
1202
|
and b.building_id in
|
|
@@ -1210,7 +1212,7 @@
|
1210
|
1212
|
and c.building_id = #{buildingId}
|
1211
|
1213
|
</if>
|
1212
|
1214
|
<if test="activityName != null and activityName != '' ">
|
1213
|
|
- and c.activity_name = #{activityName}
|
|
1215
|
+ and c.activity_name like concat('%', #{activityName}, '%')
|
1214
|
1216
|
</if>
|
1215
|
1217
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
1216
|
1218
|
and c.building_id in
|
|
@@ -1225,7 +1227,7 @@
|
1225
|
1227
|
and d.building_id = #{buildingId}
|
1226
|
1228
|
</if>
|
1227
|
1229
|
<if test="activityName != null and activityName != '' ">
|
1228
|
|
- and d.name = #{activityName}
|
|
1230
|
+ and d.name like concat('%', #{activityName}, '%')
|
1229
|
1231
|
</if>
|
1230
|
1232
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
1231
|
1233
|
and (d.building_id in
|
|
@@ -1243,7 +1245,7 @@
|
1243
|
1245
|
and e.building_id = #{buildingId}
|
1244
|
1246
|
</if>
|
1245
|
1247
|
<if test="activityName != null and activityName != '' ">
|
1246
|
|
- and e.live_activity_title = #{activityName}
|
|
1248
|
+ and e.live_activity_title like concat('%', #{activityName}, '%')
|
1247
|
1249
|
</if>
|
1248
|
1250
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
1249
|
1251
|
and (e.building_id in
|
|
@@ -1261,7 +1263,8 @@
|
1261
|
1263
|
'activity', 'group','h5','help','liveApp','livePost')
|
1262
|
1264
|
and a.org_id = #{orgId}
|
1263
|
1265
|
<if test="targetType != null and targetType != ''">
|
1264
|
|
- and a.tagert_type = #{targetType}
|
|
1266
|
+ and (case when #{targetType} = 'live' then a.tagert_type in ('liveApp', 'livePost') else a.tagert_type = #{targetType}
|
|
1267
|
+ end)
|
1265
|
1268
|
</if>
|
1266
|
1269
|
<if test="startDate != null ">
|
1267
|
1270
|
and a.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
|
@@ -1281,7 +1284,8 @@
|
1281
|
1284
|
From ta_share_count a where a.tagert_type in ( 'activity', 'group','h5','help','liveApp','livePost')
|
1282
|
1285
|
and a.org_id = #{orgId}
|
1283
|
1286
|
<if test="targetType != null and targetType != ''">
|
1284
|
|
- and a.tagert_type = #{targetType}
|
|
1287
|
+ and (case when #{targetType} = 'live' then a.tagert_type in ('liveApp', 'livePost') else a.tagert_type = #{targetType}
|
|
1288
|
+ end)
|
1285
|
1289
|
</if>
|
1286
|
1290
|
<if test="startDate != null ">
|
1287
|
1291
|
and a.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S' )
|
|
@@ -1292,7 +1296,8 @@
|
1292
|
1296
|
<if test="startDate == null or endDate == null ">
|
1293
|
1297
|
AND a.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
1294
|
1298
|
</if>
|
1295
|
|
- group by a.person_id, be_share, tagert_type
|
|
1299
|
+ group by a.person_id, be_share
|
|
1300
|
+ <!-- , be_share, tagert_type-->
|
1296
|
1301
|
) as sharePersonNum group by sharePersonNum.be_share, sharePersonNum.tagert_type
|
1297
|
1302
|
) as sharePersonNum on sharePersonNum.be_share = activity.activityId and sharePersonNum.tagert_type =
|
1298
|
1303
|
activity.activityType
|
|
@@ -1523,7 +1528,14 @@
|
1523
|
1528
|
ifnull(shareNum, 0) as shareNum,
|
1524
|
1529
|
ifnull(visitNum, 0) as visitNum,
|
1525
|
1530
|
ifnull(visitPersonNum, 0) as visitPersonNum,
|
1526
|
|
- person.person_type as sharePersonType,
|
|
1531
|
+ CASE
|
|
1532
|
+ WHEN person.person_type = 'drift' THEN
|
|
1533
|
+ "游客"
|
|
1534
|
+ WHEN person.person_type = 'customer' THEN
|
|
1535
|
+ "普通客户"
|
|
1536
|
+ WHEN person.person_type = 'Realty Consultant' THEN
|
|
1537
|
+ "置业顾问"
|
|
1538
|
+ END `sharePersonType`,
|
1527
|
1539
|
person.person_id
|
1528
|
1540
|
from (
|
1529
|
1541
|
SELECT t.*, f.nickname, f.phone, f.person_type
|
|
@@ -1645,7 +1657,9 @@
|
1645
|
1657
|
and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
|
1646
|
1658
|
</if>
|
1647
|
1659
|
and t.target_type in ('dynamic_share','h5_share','help_share','live_share', 'group_share')
|
1648
|
|
- and t.org_id = #{orgId} group by t.share_person ) t
|
|
1660
|
+ and t.org_id = #{orgId}
|
|
1661
|
+ <!-- group by t.share_person -->
|
|
1662
|
+ ) t
|
1649
|
1663
|
left join ta_person a on t.share_person = a.person_id
|
1650
|
1664
|
left join ta_person b on t.share_person = b.user_id
|
1651
|
1665
|
) as visitPersonNum on visitPersonNum.person_id = person.person_id
|
|
@@ -1779,7 +1793,8 @@
|
1779
|
1793
|
and t.be_share = #{activityId}
|
1780
|
1794
|
</if>
|
1781
|
1795
|
<if test="activityType != null and activityType != ''">
|
1782
|
|
- and t.tagert_type = #{activityType}
|
|
1796
|
+ and (case when #{activityType} = 'live' then t.tagert_type in ('liveApp', 'livePost') else t.tagert_type = #{activityType}
|
|
1797
|
+ end)
|
1783
|
1798
|
</if>
|
1784
|
1799
|
<if test="buildingId != null and buildingId != ''">
|
1785
|
1800
|
and (
|
|
@@ -2293,14 +2308,15 @@
|
2293
|
2308
|
SELECT count(1) as visitNum, t.person_id, t.create_date
|
2294
|
2309
|
FROM ta_share_person_from t
|
2295
|
2310
|
WHERE t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date <=
|
2296
|
|
- DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' ) and t.target_type in
|
2297
|
|
- ('dynamic_share','h5_share','help_share','live_share', 'group_share')
|
|
2311
|
+ DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
|
2298
|
2312
|
<if test="activityId != null and activityId != ''">
|
2299
|
2313
|
and t.target_id = #{activityId}
|
2300
|
2314
|
</if>
|
2301
|
2315
|
<if test="activityType != null and activityType != ''">
|
2302
|
2316
|
and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
|
2303
|
2317
|
</if>
|
|
2318
|
+ and t.target_type in
|
|
2319
|
+ ('dynamic_share','h5_share','help_share','live_share', 'group_share')
|
2304
|
2320
|
and
|
2305
|
2321
|
(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})
|
2306
|
2322
|
or t.share_person = #{personId})
|
|
@@ -2330,17 +2346,16 @@
|
2330
|
2346
|
ifnull(e.nickname, f.user_name) as sharePersonName,
|
2331
|
2347
|
ifnull(e.phone, f.phone) as sharePersonPhone
|
2332
|
2348
|
From (
|
2333
|
|
- SELECT t.person_id, t.create_date
|
|
2349
|
+ SELECT t.person_id, t.create_date, t.share_person
|
2334
|
2350
|
FROM ta_share_person_from t
|
2335
|
2351
|
LEFT JOIN (
|
2336
|
|
- SELECT a.person_id, b.user_id, t.share_person
|
|
2352
|
+ SELECT a.person_id, b.user_id
|
2337
|
2353
|
FROM ta_person a
|
2338
|
2354
|
LEFT JOIN ta_user b
|
2339
|
2355
|
ON a.user_id = b.user_id
|
2340
|
2356
|
WHERE a.org_id = #{orgId} ) as a ON t.share_person = a.person_id or t.share_person = a.user_id
|
2341
|
2357
|
WHERE t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%I:%S' ) and t.create_date <=
|
2342
|
|
- DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' )
|
2343
|
|
- and t.target_type in
|
|
2358
|
+ DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%I:%S' ) and t.target_type in
|
2344
|
2359
|
('dynamic_share','h5_share','help_share','live_share', 'group_share')
|
2345
|
2360
|
<if test="activityId != null and activityId != ''">
|
2346
|
2361
|
and t.target_id = #{activityId}
|