|
|
|
|
92
|
a.person_type in ('estate agent', 'channel agent')
|
92
|
a.person_type in ('estate agent', 'channel agent')
|
93
|
and a.status >0
|
93
|
and a.status >0
|
94
|
<if test="name != null and name !=''">
|
94
|
<if test="name != null and name !=''">
|
95
|
- and a.nickname like concat('%', #{name}, '%')
|
|
|
|
|
95
|
+ and (a.nickname like concat('%', #{name}, '%') or a.name like concat('%', #{name}, '%'))
|
96
|
</if>
|
96
|
</if>
|
97
|
<if test="tel != null and tel!=''">
|
97
|
<if test="tel != null and tel!=''">
|
98
|
and a.phone like concat('%', #{tel}, '%')
|
98
|
and a.phone like concat('%', #{tel}, '%')
|
|
|
|
|
490
|
|
490
|
|
491
|
<select id="getIndependentAgentsExport" resultType="com.huiju.estateagents.excel.AgentsRecommendCustomer">
|
491
|
<select id="getIndependentAgentsExport" resultType="com.huiju.estateagents.excel.AgentsRecommendCustomer">
|
492
|
SELECT
|
492
|
SELECT
|
493
|
- a.nickname as nickname,
|
|
|
|
|
493
|
+ ifnull(a.nickname, a.name) as nickname,
|
494
|
a.phone as phone,
|
494
|
a.phone as phone,
|
495
|
if(a.gender = '1', '男', if(a.gender = '2', '女', '未知')) as gender,
|
495
|
if(a.gender = '1', '男', if(a.gender = '2', '女', '未知')) as gender,
|
496
|
'专业经纪人' as personType,
|
496
|
'专业经纪人' as personType,
|
|
|
|
|
515
|
) AS recommedCount
|
515
|
) AS recommedCount
|
516
|
FROM
|
516
|
FROM
|
517
|
ta_person a
|
517
|
ta_person a
|
518
|
- left join ta_channel_person tcp on a.person_id = tcp.person_id
|
|
|
|
|
518
|
+ left join ta_channel_person tcp on a.person_id = tcp.person_id and tcp.status = 1
|
519
|
left join ta_channel tc on tc.channel_id = tcp.channel_id
|
519
|
left join ta_channel tc on tc.channel_id = tcp.channel_id
|
520
|
<where>
|
520
|
<where>
|
521
|
ifnull(a.person_type, '') in ('channel agent', 'estate agent')
|
521
|
ifnull(a.person_type, '') in ('channel agent', 'estate agent')
|
|
|
|
|
524
|
and a.org_id = #{orgId}
|
524
|
and a.org_id = #{orgId}
|
525
|
</if>
|
525
|
</if>
|
526
|
<if test="name != null and name != ''">
|
526
|
<if test="name != null and name != ''">
|
527
|
- and a.nickname like concat('%', #{name}, '%')
|
|
|
|
|
527
|
+ and (a.nickname like concat('%', #{name}, '%') or a.name like concat('%', #{name}, '%'))
|
528
|
</if>
|
528
|
</if>
|
529
|
<if test="tel != null and tel != null">
|
529
|
<if test="tel != null and tel != null">
|
530
|
and a.phone like concat('%', #{tel}, '%')
|
530
|
and a.phone like concat('%', #{tel}, '%')
|