|
@@ -170,7 +170,7 @@
|
170
|
170
|
sequence a
|
171
|
171
|
<trim prefix="where">
|
172
|
172
|
<if test="startDate != null or endDate != null">
|
173
|
|
- a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
|
173
|
+ a.rownum <![CDATA[ < ]]> datediff(#{endDate}, #{startDate})
|
174
|
174
|
</if>
|
175
|
175
|
</trim>
|
176
|
176
|
) AS temp_date
|
|
@@ -248,7 +248,7 @@
|
248
|
248
|
sequence a
|
249
|
249
|
<trim prefix="where">
|
250
|
250
|
<if test="startDate != null or endDate != null">
|
251
|
|
- a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
|
251
|
+ a.rownum <![CDATA[ < ]]> datediff(#{endDate}, #{startDate})
|
252
|
252
|
</if>
|
253
|
253
|
</trim>
|
254
|
254
|
) AS temp_date
|
|
@@ -326,7 +326,7 @@
|
326
|
326
|
sequence a
|
327
|
327
|
<trim prefix="where">
|
328
|
328
|
<if test="startDate != null or endDate != null">
|
329
|
|
- a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
|
329
|
+ a.rownum <![CDATA[ < ]]> datediff(#{endDate}, #{startDate})
|
330
|
330
|
</if>
|
331
|
331
|
</trim>
|
332
|
332
|
) AS temp_date
|
|
@@ -376,7 +376,7 @@
|
376
|
376
|
sequence a
|
377
|
377
|
<trim prefix="where">
|
378
|
378
|
<if test="startDate != null or endDate != null">
|
379
|
|
- a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
|
379
|
+ a.rownum <![CDATA[ < ]]> datediff(#{endDate}, #{startDate})
|
380
|
380
|
</if>
|
381
|
381
|
</trim>
|
382
|
382
|
) AS temp_date
|
|
@@ -425,7 +425,7 @@
|
425
|
425
|
sequence a
|
426
|
426
|
<trim prefix="where">
|
427
|
427
|
<if test="startDate != null or endDate != null">
|
428
|
|
- a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
|
428
|
+ a.rownum <![CDATA[ < ]]> datediff(#{endDate}, #{startDate})
|
429
|
429
|
</if>
|
430
|
430
|
</trim>
|
431
|
431
|
) AS temp_date
|
|
@@ -481,7 +481,7 @@
|
481
|
481
|
sequence a
|
482
|
482
|
<trim prefix="where">
|
483
|
483
|
<if test="startDate != null or endDate != null">
|
484
|
|
- a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
|
484
|
+ a.rownum <![CDATA[ < ]]> datediff(#{endDate}, #{startDate})
|
485
|
485
|
</if>
|
486
|
486
|
</trim>
|
487
|
487
|
) AS temp_date
|
|
@@ -694,7 +694,7 @@
|
694
|
694
|
sequence a
|
695
|
695
|
<trim prefix="where">
|
696
|
696
|
<if test="startDate != null or endDate != null">
|
697
|
|
- a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
|
697
|
+ a.rownum <![CDATA[ < ]]> datediff(#{endDate}, #{startDate})
|
698
|
698
|
</if>
|
699
|
699
|
</trim>
|
700
|
700
|
) AS temp_date
|
|
@@ -961,10 +961,12 @@
|
961
|
961
|
and d.name like concat('%', #{activityName}, '%')
|
962
|
962
|
</if>
|
963
|
963
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
964
|
|
- and d.building_id in
|
|
964
|
+ and (d.building_id in
|
965
|
965
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
966
|
966
|
#{taPersonBuilding.buildingId}
|
967
|
967
|
</foreach>
|
|
968
|
+ or d.create_user = #{userId}
|
|
969
|
+ )
|
968
|
970
|
</if>
|
969
|
971
|
union all
|
970
|
972
|
select e.live_activity_id as activityId, e.live_activity_title as activityName, "live" as activityType From
|
|
@@ -977,10 +979,12 @@
|
977
|
979
|
and e.live_activity_title like concat('%', #{activityName}, '%')
|
978
|
980
|
</if>
|
979
|
981
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
980
|
|
- and e.building_id in
|
|
982
|
+ and (e.building_id in
|
981
|
983
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
982
|
984
|
#{taPersonBuilding.buildingId}
|
983
|
985
|
</foreach>
|
|
986
|
+ or e.create_user = #{userId}
|
|
987
|
+ )
|
984
|
988
|
</if>
|
985
|
989
|
) as activity
|
986
|
990
|
|
|
@@ -1169,10 +1173,12 @@
|
1169
|
1173
|
and d.name = #{activityName}
|
1170
|
1174
|
</if>
|
1171
|
1175
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
1172
|
|
- and c.building_id in
|
|
1176
|
+ and (d.building_id in
|
1173
|
1177
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1174
|
1178
|
#{taPersonBuilding.buildingId}
|
1175
|
1179
|
</foreach>
|
|
1180
|
+ or d.create_user = #{userId}
|
|
1181
|
+ )
|
1176
|
1182
|
</if>
|
1177
|
1183
|
union all
|
1178
|
1184
|
select e.live_activity_id as activityId, e.live_activity_title as activityName, "live" as activityType From
|
|
@@ -1185,10 +1191,12 @@
|
1185
|
1191
|
and e.live_activity_title = #{activityName}
|
1186
|
1192
|
</if>
|
1187
|
1193
|
<if test="taPersonBuildings != null and taPersonBuildings.size > 0">
|
1188
|
|
- and e.building_id in
|
|
1194
|
+ and (e.building_id in
|
1189
|
1195
|
<foreach collection="taPersonBuildings" item="taPersonBuilding" open="(" close=")" separator=",">
|
1190
|
1196
|
#{taPersonBuilding.buildingId}
|
1191
|
1197
|
</foreach>
|
|
1198
|
+ or e.create_user = #{userId}
|
|
1199
|
+ )
|
1192
|
1200
|
</if>
|
1193
|
1201
|
) as activity
|
1194
|
1202
|
|
|
@@ -1416,7 +1424,7 @@
|
1416
|
1424
|
<if test="activityType != null and activityType != ''">
|
1417
|
1425
|
and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
|
1418
|
1426
|
</if>
|
1419
|
|
- and t.org_id = #{orgId} group by t.share_person ) t
|
|
1427
|
+ and t.org_id = #{orgId} ) t
|
1420
|
1428
|
left join ta_person a on t.share_person = a.person_id
|
1421
|
1429
|
left join ta_person b on t.share_person = b.user_id
|
1422
|
1430
|
) as visitNum on visitNum.person_id = person.person_id
|
|
@@ -1440,6 +1448,7 @@
|
1440
|
1448
|
left join ta_person a on t.share_person = a.person_id
|
1441
|
1449
|
left join ta_person b on t.share_person = b.user_id
|
1442
|
1450
|
) as visitPersonNum on visitPersonNum.person_id = person.person_id
|
|
1451
|
+ group by person.person_id
|
1443
|
1452
|
<if test="colKey == null or colKey == ''">
|
1444
|
1453
|
order by person.create_date desc
|
1445
|
1454
|
</if>
|
|
@@ -1555,7 +1564,7 @@
|
1555
|
1564
|
<if test="activityType != null and activityType != ''">
|
1556
|
1565
|
and t.target_type = concat(REPLACE(#{activityType}, 'activity', 'dynamic'), '_share')
|
1557
|
1566
|
</if>
|
1558
|
|
- and t.org_id = #{orgId} group by t.share_person ) t
|
|
1567
|
+ and t.org_id = #{orgId} ) t
|
1559
|
1568
|
left join ta_person a on t.share_person = a.person_id
|
1560
|
1569
|
left join ta_person b on t.share_person = b.user_id
|
1561
|
1570
|
) as visitNum on visitNum.person_id = person.person_id
|
|
@@ -1579,6 +1588,7 @@
|
1579
|
1588
|
left join ta_person a on t.share_person = a.person_id
|
1580
|
1589
|
left join ta_person b on t.share_person = b.user_id
|
1581
|
1590
|
) as visitPersonNum on visitPersonNum.person_id = person.person_id
|
|
1591
|
+ group by person.person_id
|
1582
|
1592
|
<if test="colKey == null or colKey == ''">
|
1583
|
1593
|
order by person.create_date desc
|
1584
|
1594
|
</if>
|
|
@@ -1784,14 +1794,14 @@
|
1784
|
1794
|
a.nickname, a.phone,
|
1785
|
1795
|
if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
|
1786
|
1796
|
a.province,
|
1787
|
|
- b1.scene_name as personFrom,
|
|
1797
|
+ b1.scene_alias as personFrom,
|
1788
|
1798
|
GROUP_CONCAT(c.name) as realtyConsultant,
|
1789
|
1799
|
ifnull(d.phone, d.tel) as realtyConsultantPhone,
|
1790
|
1800
|
ifnull(e.nickname, f.user_name) as sharePersonName,
|
1791
|
1801
|
ifnull(e.phone, e.tel) as sharePersonPhone
|
1792
|
1802
|
FROM ta_share_person_from t
|
1793
|
1803
|
left join ta_person a on t.person_id = a.person_id
|
1794
|
|
- left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = 84 and b.is_first_time =1
|
|
1804
|
+ 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
|
1795
|
1805
|
left join td_wx_dict b1 on b.scene_id = b1.scene_id
|
1796
|
1806
|
left join ta_recommend_customer c on c.person_id = t.person_id
|
1797
|
1807
|
left join ta_person d on c.recommend_person = d.person_id
|
|
@@ -1808,6 +1818,9 @@
|
1808
|
1818
|
<if test="activityType != null and activityType != ''">
|
1809
|
1819
|
and t.target_type = concat(#{activityType}, '_share')
|
1810
|
1820
|
</if>
|
|
1821
|
+ <if test="province != null and province != ''">
|
|
1822
|
+ and a.province like concat('%', #{province}, '%')
|
|
1823
|
+ </if>
|
1811
|
1824
|
<if test="personFrom != null and personFrom != ''">
|
1812
|
1825
|
and b.scene_type = #{personFrom}
|
1813
|
1826
|
</if>
|
|
@@ -1823,14 +1836,14 @@
|
1823
|
1836
|
a.nickname, a.phone,
|
1824
|
1837
|
if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
|
1825
|
1838
|
a.province,
|
1826
|
|
- b1.scene_name as personFrom,
|
|
1839
|
+ b1.scene_alias as personFrom,
|
1827
|
1840
|
GROUP_CONCAT(c.name) as realtyConsultant,
|
1828
|
1841
|
ifnull(d.phone, d.tel) as realtyConsultantPhone,
|
1829
|
1842
|
ifnull(e.nickname, f.user_name) as sharePersonName,
|
1830
|
1843
|
ifnull(e.phone, e.tel) as sharePersonPhone
|
1831
|
1844
|
FROM ta_share_person_from t
|
1832
|
1845
|
left join ta_person a on t.person_id = a.person_id
|
1833
|
|
- left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = 84 and b.is_first_time =1
|
|
1846
|
+ 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
|
1834
|
1847
|
left join td_wx_dict b1 on b.scene_id = b1.scene_id
|
1835
|
1848
|
left join ta_recommend_customer c on c.person_id = t.person_id
|
1836
|
1849
|
left join ta_person d on c.recommend_person = d.person_id
|
|
@@ -1847,6 +1860,9 @@
|
1847
|
1860
|
<if test="activityType != null and activityType != ''">
|
1848
|
1861
|
and t.target_type = concat(#{activityType}, '_share')
|
1849
|
1862
|
</if>
|
|
1863
|
+ <if test="province != null and province != ''">
|
|
1864
|
+ and a.province like concat('%', #{province}, '%')
|
|
1865
|
+ </if>
|
1850
|
1866
|
<if test="personFrom != null and personFrom != ''">
|
1851
|
1867
|
and b.scene_type = #{personFrom}
|
1852
|
1868
|
</if>
|