|
@@ -111,13 +111,13 @@ FROM
|
111
|
111
|
SELECT
|
112
|
112
|
a.*,
|
113
|
113
|
a.customer_id AS customerId,
|
114
|
|
- if(b.NAME = null, d.name, b.name) as consultantName,
|
115
|
|
- if(b.tel = null, d.tel, b.tel) AS consultTel,
|
|
114
|
+ IFNULL(d.user_name, b.name) as consultantName,
|
|
115
|
+ IFNULL(d.phone, b.tel) as consultTel,
|
116
|
116
|
c.building_name as intentionName
|
117
|
117
|
FROM
|
118
|
118
|
ta_recommend_customer a
|
119
|
119
|
LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
|
120
|
|
- LEFT JOIN ta_person d on a.realty_consultant = d.user_id
|
|
120
|
+ LEFT JOIN ta_user d on a.realty_consultant = d.user_id
|
121
|
121
|
LEFT JOIN ta_building c ON a.building_id = c.building_id
|
122
|
122
|
<where>
|
123
|
123
|
a.status > 0
|
|
@@ -135,10 +135,10 @@ FROM
|
135
|
135
|
and a.phone like concat(concat("%",#{tel}),"%")
|
136
|
136
|
</if>
|
137
|
137
|
<if test="consultName != null and consultName !=''">
|
138
|
|
- and b.name like CONCAT('%',#{consultName}, '%')
|
|
138
|
+ and IFNULL(d.user_name, b.name) like CONCAT('%',#{consultName}, '%')
|
139
|
139
|
</if>
|
140
|
140
|
<if test="consultTel != null and consultTel !=''">
|
141
|
|
- and b.tel = #{consultTel}
|
|
141
|
+ and IFNULL(d.phone, b.tel) = #{consultTel}
|
142
|
142
|
</if>
|
143
|
143
|
<if test="entryType != null and entryType !=''">
|
144
|
144
|
and a.entry_type = #{entryType}
|
|
@@ -377,11 +377,12 @@ FROM
|
377
|
377
|
a.phone as phone,
|
378
|
378
|
c.building_name as intentionName,
|
379
|
379
|
if(a.sex = 1, '男',if(a.sex = 2, '女', '未知')) as sex,
|
380
|
|
- b.NAME AS consultantName,
|
381
|
|
- b.tel AS consultTel
|
|
380
|
+ IFNULL(d.user_name, b.name) as consultantName,
|
|
381
|
+ IFNULL(d.phone, b.tel) as consultTel
|
382
|
382
|
FROM
|
383
|
383
|
ta_recommend_customer a
|
384
|
384
|
LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
|
|
385
|
+ LEFT JOIN ta_user d on a.realty_consultant = d.user_id
|
385
|
386
|
LEFT JOIN ta_building c ON a.building_id = c.building_id
|
386
|
387
|
<where>
|
387
|
388
|
a.status > 0
|
|
@@ -399,10 +400,10 @@ FROM
|
399
|
400
|
and a.phone like concat(concat("%",#{tel}),"%")
|
400
|
401
|
</if>
|
401
|
402
|
<if test="consultName != null and consultName !=''">
|
402
|
|
- and b.name like CONCAT('%',#{consultName}, '%')
|
|
403
|
+ and IFNULL(d.user_name, b.name) like CONCAT('%',#{consultName}, '%')
|
403
|
404
|
</if>
|
404
|
405
|
<if test="consultTel != null and consultTel !=''">
|
405
|
|
- and b.tel = #{consultTel}
|
|
406
|
+ and IFNULL(d.phone, b.tel) = #{consultTel}
|
406
|
407
|
</if>
|
407
|
408
|
<if test="entryType != null and entryType !=''">
|
408
|
409
|
and a.entry_type = #{entryType}
|