|
@@ -1210,7 +1210,7 @@
|
1210
|
1210
|
</if>
|
1211
|
1211
|
group by a.person_id, a.target_type ,a.target_id
|
1212
|
1212
|
) as addRegistNum group by addRegistNum.target_type, addRegistNum.target_id
|
1213
|
|
- ) as addRegistNum on addRegistNum.target_id = activity.activityId and REPLACE(addRegistNum.target_type, 'dynamic_share', 'activity') = activity.activityType
|
|
1213
|
+ ) as addRegistNum on addRegistNum.target_id = activity.activityId and activity.activityType = substring_index(REPLACE(addRegistNum.target_type, 'dynamic_share', 'activity_share') , '_share', 1)
|
1214
|
1214
|
<if test="targetType != null and targetType != ''">
|
1215
|
1215
|
where activity.activityType = #{targetType}
|
1216
|
1216
|
</if>
|
|
@@ -1422,7 +1422,7 @@
|
1422
|
1422
|
</if>
|
1423
|
1423
|
group by a.person_id, a.target_type ,a.target_id
|
1424
|
1424
|
) as addRegistNum group by addRegistNum.target_type, addRegistNum.target_id
|
1425
|
|
- ) as addRegistNum on addRegistNum.target_id = activity.activityId and REPLACE(addRegistNum.target_type, 'dynamic_share', 'activity') = activity.activityType
|
|
1425
|
+ ) as addRegistNum on addRegistNum.target_id = activity.activityId and activity.activityType = substring_index(REPLACE(addRegistNum.target_type, 'dynamic_share', 'activity_share') , '_share', 1)
|
1426
|
1426
|
<if test="targetType != null and targetType != ''">
|
1427
|
1427
|
where activity.activityType = #{targetType}
|
1428
|
1428
|
</if>
|
|
@@ -1516,8 +1516,8 @@
|
1516
|
1516
|
) as person
|
1517
|
1517
|
|
1518
|
1518
|
left join (
|
1519
|
|
- select * from (
|
1520
|
|
- SELECT count(*) as shareNum, t.person_id
|
|
1519
|
+ select count(*) as shareNum, temp.person_id from (
|
|
1520
|
+ SELECT t.person_id, t.create_date
|
1521
|
1521
|
FROM ta_share_count t
|
1522
|
1522
|
LEFT JOIN ta_help_activity a ON t.be_share = a.help_activity_id
|
1523
|
1523
|
LEFT JOIN ta_share_activity b ON t.be_share = b.share_id
|
|
@@ -1536,8 +1536,8 @@
|
1536
|
1536
|
and (case when #{activityType} = 'live' then t.tagert_type in ('liveApp', 'livePost') else t.tagert_type = #{activityType}
|
1537
|
1537
|
end)
|
1538
|
1538
|
</if>
|
1539
|
|
- group by person_id
|
1540
|
|
- ) as temp
|
|
1539
|
+ order by t.create_date desc limit 999999
|
|
1540
|
+ ) as temp group by temp.person_id order by temp.create_date desc
|
1541
|
1541
|
) as shareNum on person.person_id = shareNum.person_id
|
1542
|
1542
|
|
1543
|
1543
|
left join (
|
|
@@ -1677,8 +1677,8 @@
|
1677
|
1677
|
) as person
|
1678
|
1678
|
|
1679
|
1679
|
left join (
|
1680
|
|
- select * from (
|
1681
|
|
- SELECT count(*) as shareNum, t.person_id
|
|
1680
|
+ select count(*) as shareNum, temp.person_id from (
|
|
1681
|
+ SELECT t.person_id, t.create_date
|
1682
|
1682
|
FROM ta_share_count t
|
1683
|
1683
|
LEFT JOIN ta_help_activity a ON t.be_share = a.help_activity_id
|
1684
|
1684
|
LEFT JOIN ta_share_activity b ON t.be_share = b.share_id
|
|
@@ -1697,8 +1697,8 @@
|
1697
|
1697
|
and (case when #{activityType} = 'live' then t.tagert_type in ('liveApp', 'livePost') else t.tagert_type = #{activityType}
|
1698
|
1698
|
end)
|
1699
|
1699
|
</if>
|
1700
|
|
- group by person_id
|
1701
|
|
- ) as temp
|
|
1700
|
+ order by t.create_date desc limit 999999
|
|
1701
|
+ ) as temp group by temp.person_id order by temp.create_date desc
|
1702
|
1702
|
) as shareNum on person.person_id = shareNum.person_id
|
1703
|
1703
|
|
1704
|
1704
|
left join (
|
|
@@ -2181,7 +2181,7 @@
|
2181
|
2181
|
GROUP_CONCAT(d.user_name) as realtyConsultant,
|
2182
|
2182
|
GROUP_CONCAT(d.phone) as realtyConsultantPhone,
|
2183
|
2183
|
t.create_date as visitDate,
|
2184
|
|
- ifnull(e.nickName, f.user_name) as sharePersonName,
|
|
2184
|
+ e.nickName as sharePersonName,
|
2185
|
2185
|
t.visitNum
|
2186
|
2186
|
from (
|
2187
|
2187
|
SELECT
|
|
@@ -2214,12 +2214,11 @@
|
2214
|
2214
|
GROUP BY
|
2215
|
2215
|
t.person_id ) as t
|
2216
|
2216
|
left join ta_person a on t.person_id = a.person_id
|
2217
|
|
- left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId}
|
|
2217
|
+ left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId} and b.is_first_time = 1
|
2218
|
2218
|
left join td_wx_dict b1 on b.scene_id = b1.scene_id
|
2219
|
2219
|
LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
|
2220
|
2220
|
left join ta_user d on c.realty_consultant = d.user_id
|
2221
|
|
- left join ta_person e on e.person_id = c.recommend_person
|
2222
|
|
- left join ta_user f on f.user_id = c.recommend_person
|
|
2221
|
+ LEFT JOIN ta_person e ON e.person_id = b.share_person_id
|
2223
|
2222
|
<where>
|
2224
|
2223
|
<if test="personFrom != null and personFrom != ''">
|
2225
|
2224
|
and b.scene_type = #{personFrom}
|
|
@@ -2248,7 +2247,7 @@
|
2248
|
2247
|
GROUP_CONCAT(d.user_name) as realtyConsultant,
|
2249
|
2248
|
GROUP_CONCAT(d.phone) as realtyConsultantPhone,
|
2250
|
2249
|
t.create_date as visitDate,
|
2251
|
|
- ifnull(e.nickName, f.user_name) as sharePersonName,
|
|
2250
|
+ e.nickName as sharePersonName,
|
2252
|
2251
|
t.visitNum
|
2253
|
2252
|
from (
|
2254
|
2253
|
SELECT
|
|
@@ -2285,8 +2284,7 @@
|
2285
|
2284
|
left join td_wx_dict b1 on b.scene_id = b1.scene_id
|
2286
|
2285
|
LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
|
2287
|
2286
|
left join ta_user d on c.realty_consultant = d.user_id
|
2288
|
|
- left join ta_person e on e.person_id = c.recommend_person
|
2289
|
|
- left join ta_user f on f.user_id = c.recommend_person
|
|
2287
|
+ LEFT JOIN ta_person e ON e.person_id = b.share_person_id
|
2290
|
2288
|
<where>
|
2291
|
2289
|
<if test="personFrom != null and personFrom != ''">
|
2292
|
2290
|
and b.scene_type = #{personFrom}
|
|
@@ -2315,7 +2313,7 @@
|
2315
|
2313
|
GROUP_CONCAT(d.user_name) as realtyConsultant,
|
2316
|
2314
|
GROUP_CONCAT(d.phone) as realtyConsultantPhone,
|
2317
|
2315
|
t.create_date as visitDate,
|
2318
|
|
- ifnull(e.nickName, f.user_name) as sharePersonName,
|
|
2316
|
+ e.nickName as sharePersonName,
|
2319
|
2317
|
t.visitNum
|
2320
|
2318
|
From (
|
2321
|
2319
|
SELECT count(1) as visitNum, t.person_id, t.create_date
|
|
@@ -2341,8 +2339,7 @@
|
2341
|
2339
|
left join td_wx_dict b1 on b.scene_id = b1.scene_id
|
2342
|
2340
|
LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
|
2343
|
2341
|
left join ta_user d on c.realty_consultant = d.user_id
|
2344
|
|
- left join ta_person e on e.person_id = c.recommend_person
|
2345
|
|
- left join ta_user f on f.user_id = c.recommend_person
|
|
2342
|
+ LEFT JOIN ta_person e ON e.person_id = b.share_person_id
|
2346
|
2343
|
group by t.person_id
|
2347
|
2344
|
</select>
|
2348
|
2345
|
|
|
@@ -2400,7 +2397,7 @@
|
2400
|
2397
|
GROUP_CONCAT(d.user_name) as realtyConsultant,
|
2401
|
2398
|
GROUP_CONCAT(d.phone) as realtyConsultantPhone,
|
2402
|
2399
|
t.create_date as visitDate,
|
2403
|
|
- ifnull(e.nickName, f.user_name) as sharePersonName,
|
|
2400
|
+ e.nickName as sharePersonName,
|
2404
|
2401
|
t.visitNum
|
2405
|
2402
|
From (
|
2406
|
2403
|
SELECT count(1) as visitNum, t.person_id, t.create_date
|
|
@@ -2426,8 +2423,7 @@
|
2426
|
2423
|
left join td_wx_dict b1 on b.scene_id = b1.scene_id
|
2427
|
2424
|
LEFT JOIN ta_recommend_customer c on c.person_id = t.person_id
|
2428
|
2425
|
left join ta_user d on c.realty_consultant = d.user_id
|
2429
|
|
- left join ta_person e on e.person_id = c.recommend_person
|
2430
|
|
- left join ta_user f on f.user_id = c.recommend_person
|
|
2426
|
+ LEFT JOIN ta_person e ON e.person_id = b.share_person_id
|
2431
|
2427
|
group by t.person_id
|
2432
|
2428
|
</select>
|
2433
|
2429
|
|