|
|
|
|
159
|
ta_recommend_customer a
|
159
|
ta_recommend_customer a
|
160
|
LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
|
160
|
LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
|
161
|
LEFT JOIN ta_person c on a.recommend_person = c.person_id
|
161
|
LEFT JOIN ta_person c on a.recommend_person = c.person_id
|
162
|
- LEFT JOIN ta_user d on d.user_id = b.user_id
|
|
|
|
|
162
|
+ LEFT JOIN ta_user d on d.user_id = a.realty_consultant
|
163
|
<where>
|
163
|
<where>
|
164
|
a.status > 0
|
164
|
a.status > 0
|
165
|
and a.realty_consultant is not null
|
165
|
and a.realty_consultant is not null
|
|
|
|
|
176
|
and a.phone like CONCAT('%',#{tel}, '%')
|
176
|
and a.phone like CONCAT('%',#{tel}, '%')
|
177
|
</if>
|
177
|
</if>
|
178
|
<if test="consultName != null and consultName !=''">
|
178
|
<if test="consultName != null and consultName !=''">
|
179
|
- and b.name like CONCAT('%',#{consultName}, '%')
|
|
|
|
|
179
|
+ and IFNULL(b.name,d.user_name) like CONCAT('%',#{consultName}, '%')
|
180
|
</if>
|
180
|
</if>
|
181
|
<if test="consultTel != null and consultTel !=''">
|
181
|
<if test="consultTel != null and consultTel !=''">
|
182
|
- and b.tel like CONCAT('%',#{consultTel}, '%')
|
|
|
|
|
182
|
+ and IFNULL(b.tel,d.phone) like CONCAT('%',#{consultTel}, '%')
|
183
|
</if>
|
183
|
</if>
|
184
|
<if test="entryType != null and entryType !=''">
|
184
|
<if test="entryType != null and entryType !=''">
|
185
|
and a.entry_type = #{entryType}
|
185
|
and a.entry_type = #{entryType}
|