|
@@ -808,39 +808,42 @@ FROM
|
808
|
808
|
|
809
|
809
|
<select id="getMyCustFollowOrClinch" resultType="com.yunzhi.marketing.entity.TaRecommendCustomer">
|
810
|
810
|
SELECT
|
811
|
|
- *
|
|
811
|
+ IFNULL( p.nickname, t.NAME ) AS NAME,
|
|
812
|
+ IFNULL( p.avatarurl, t.picture ) AS picture,
|
|
813
|
+ t.*
|
812
|
814
|
FROM
|
813
|
|
- ta_recommend_customer
|
|
815
|
+ ta_recommend_customer t
|
|
816
|
+ LEFT JOIN ta_person p ON t.person_id = p.person_id
|
814
|
817
|
WHERE
|
815
|
|
- org_id = #{orgId}
|
816
|
|
- AND ( realty_consultant = #{personId} OR realty_consultant = #{userId} )
|
|
818
|
+ t.org_id = #{orgId}
|
|
819
|
+ AND ( t.realty_consultant = #{personId} OR t.realty_consultant = #{userId} )
|
817
|
820
|
<if test="type == 'follow'">
|
818
|
|
- AND STATUS != 4
|
819
|
|
- AND verify_status = 1
|
|
821
|
+ AND t.STATUS != 4
|
|
822
|
+ AND t.verify_status = 1
|
820
|
823
|
<if test="name != null and name !=''">
|
821
|
|
- and (`name` like CONCAT('%',#{name}, '%') or phone like CONCAT('%',#{name}, '%'))
|
|
824
|
+ and (p.nickname like CONCAT('%',#{name}, '%') or t.`name` like CONCAT('%',#{name}, '%') or t.phone like CONCAT('%',#{name}, '%'))
|
822
|
825
|
</if>
|
823
|
826
|
<if test="phone != null and phone !=''">
|
824
|
|
- and phone like CONCAT('%',#{phone}, '%')
|
|
827
|
+ and t.phone like CONCAT('%',#{phone}, '%')
|
825
|
828
|
</if>
|
826
|
829
|
<if test="status != null and status !=''">
|
827
|
|
- and status = #{status}
|
|
830
|
+ and t.status = #{status}
|
828
|
831
|
</if>
|
829
|
832
|
<if test="startReportDate != null and startReportDate !=''">
|
830
|
|
- and date_format( report_date, '%Y-%m-%d' ) >= #{startReportDate}
|
|
833
|
+ and date_format( t.report_date, '%Y-%m-%d' ) >= #{startReportDate}
|
831
|
834
|
</if>
|
832
|
835
|
<if test="endReportDate != null and endReportDate !=''">
|
833
|
|
- and date_format( report_date, '%Y-%m-%d' ) <= #{endReportDate}
|
|
836
|
+ and date_format( t.report_date, '%Y-%m-%d' ) <= #{endReportDate}
|
834
|
837
|
</if>
|
835
|
838
|
<if test="startArrivalDate != null and startArrivalDate !=''">
|
836
|
|
- and date_format( arrival_date, '%Y-%m-%d' ) >= #{startArrivalDate}
|
|
839
|
+ and date_format( t.arrival_date, '%Y-%m-%d' ) >= #{startArrivalDate}
|
837
|
840
|
</if>
|
838
|
841
|
<if test="endArrivalDate != null and endArrivalDate !=''">
|
839
|
|
- and date_format( arrival_date, '%Y-%m-%d' ) <= #{endArrivalDate}
|
|
842
|
+ and date_format( t.arrival_date, '%Y-%m-%d' ) <= #{endArrivalDate}
|
840
|
843
|
</if>
|
841
|
844
|
</if>
|
842
|
845
|
<if test="type == 'clinch'">
|
843
|
|
- AND STATUS = 4
|
|
846
|
+ AND t.STATUS = 4
|
844
|
847
|
</if>
|
845
|
848
|
</select>
|
846
|
849
|
|