|
@@ -551,11 +551,15 @@ FROM
|
551
|
551
|
concat(b.country, b.province) as province,
|
552
|
552
|
z.intention,
|
553
|
553
|
d.scene_alias as sceneType,
|
554
|
|
- t.building_name
|
|
554
|
+ t.building_name,
|
|
555
|
+ ifnull( c.nickname, c.NAME ) AS sharePersonName ,
|
|
556
|
+ s.points
|
555
|
557
|
FROM
|
556
|
558
|
ta_person b
|
557
|
559
|
LEFT JOIN ta_person_from_record r ON b.person_id = r.person_id AND r.is_first_time = 1 and r.org_id = #{orgId}
|
558
|
560
|
left join ta_building t on b.building_id = t.building_id
|
|
561
|
+ LEFT JOIN ta_person c ON b.recommend_person = c.person_id AND c.org_id = #{orgId}
|
|
562
|
+ left JOIN (select sum(points_amount) as points,person_id from ta_points_records where org_id = #{orgId} GROUP BY person_id) s on b.person_id = s.person_id
|
559
|
563
|
left join (select sum(t.intention) as intention,t.person_id From ta_person_intention_record t where t.org_id = #{orgId} group by t.person_id) z on z.person_id = b.person_id
|
560
|
564
|
left join td_wx_dict d on r.scene_id = d.scene_id
|
561
|
565
|
<where>
|
|
@@ -591,7 +595,7 @@ FROM
|
591
|
595
|
<if test="consultTel != null and consultTel !=''">
|
592
|
596
|
and b.tel like CONCAT('%',#{consultTel}, '%')
|
593
|
597
|
</if>
|
594
|
|
- and NOT EXISTS ( select * from ta_recommend_customer a where a.org_id = #{orgId} and a.recommend_person = b.person_id)
|
|
598
|
+<!-- and NOT EXISTS ( select * from ta_recommend_customer a where a.org_id = #{orgId} and a.recommend_person = b.person_id)-->
|
595
|
599
|
AND b.person_id not IN ( SELECT c.person_id FROM ta_recommend_customer c WHERE c.org_id = #{orgId} AND person_id is not null AND person_id != '' )
|
596
|
600
|
</where>
|
597
|
601
|
order by b.create_date desc
|
|
@@ -667,15 +671,18 @@ FROM
|
667
|
671
|
z.intention,
|
668
|
672
|
a.create_date,
|
669
|
673
|
concat(a.country,a.province) as province,
|
670
|
|
- w.scene_alias as scene_type
|
|
674
|
+ w.scene_alias as scene_type,
|
|
675
|
+ IFNULL( c.NAME, c.nickname ) AS sharePersonName,
|
|
676
|
+ s.points
|
671
|
677
|
FROM
|
672
|
678
|
ta_recommend_customer a
|
673
|
679
|
LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
|
674
|
|
- LEFT JOIN ta_person c ON a.realty_consultant = c.user_id
|
675
|
680
|
LEFT JOIN ta_user d on d.user_id = a.realty_consultant
|
676
|
681
|
LEFT JOIN ta_person_from_record p ON a.person_id = p.person_id AND p.is_first_time = 1 and p.org_id = #{orgId}
|
|
682
|
+ LEFT JOIN ta_person c ON p.share_person_id = c.person_id
|
677
|
683
|
left join ta_building t on a.building_id = t.building_id
|
678
|
684
|
LEFT JOIN td_wx_dict w ON p.scene_id = w.scene_id
|
|
685
|
+ left JOIN (select sum(points_amount) as points,person_id from ta_points_records where org_id = #{orgId} GROUP BY person_id) s on a.person_id = s.person_id
|
679
|
686
|
left join (select sum(t.intention) as intention,t.person_id From ta_person_intention_record t where t.org_id = #{orgId} group by t.person_id) z on z.person_id = a.person_id
|
680
|
687
|
<where>
|
681
|
688
|
a.status > 0
|