|
|
@@ -329,7 +329,7 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="selectOrganizationCustomerList" resultType="com.goafanti.customer.bo.CustomerListOut">
|
|
|
- select DISTINCT
|
|
|
+ select
|
|
|
a.id as uid,
|
|
|
a.nickname as name,
|
|
|
date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTime,
|
|
|
@@ -344,29 +344,30 @@
|
|
|
a.new_channel as newChannel,
|
|
|
a.level,
|
|
|
b.org_code orgCode
|
|
|
-
|
|
|
from `user` a
|
|
|
- left join user_names un on a.id=un.uid
|
|
|
+ inner join (SELECT DISTINCT uid FROM user_names
|
|
|
+ <if test="role == 0">
|
|
|
+ <if test="names !=null">
|
|
|
+ WHERE name in
|
|
|
+ <foreach close=")" collection="names" item="name" open="(" separator=",">
|
|
|
+ #{name}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="names ==null and orgCode==null">
|
|
|
+ is null
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="role == 1 and name != null">
|
|
|
+ WHERE name like concat('%', #{name},'%')
|
|
|
+ </if>
|
|
|
+ ) un on a.id=un.uid
|
|
|
left join organization_identity b on a.id = b.uid
|
|
|
left join district_glossory dg1 on b.location_province = dg1.id
|
|
|
left join district_glossory dg2 on b.location_city = dg2.id
|
|
|
left join district_glossory dg3 on b.location_area = dg3.id
|
|
|
left join admin d on a.aid = d.id
|
|
|
where a.type = 1 and a.status =0 and a.source in (1,2,3)
|
|
|
- <if test="role == 0">
|
|
|
- <if test="names !=null">
|
|
|
- and un.name in
|
|
|
- <foreach close=")" collection="names" item="name" open="(" separator=",">
|
|
|
- #{name}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="names ==null and orgCode==null">
|
|
|
- is null
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="role == 1 and name != null">
|
|
|
- and un.name like concat('%', #{name},'%')
|
|
|
- </if>
|
|
|
+
|
|
|
<if test="aid != null and aid !=''">
|
|
|
and a.aid = #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
@@ -400,17 +401,10 @@
|
|
|
select
|
|
|
count(0)
|
|
|
from(select a.id from `user` a
|
|
|
- left join user_names un on a.id=un.uid
|
|
|
- left join organization_identity b on a.id = b.uid
|
|
|
- <if test="departmentId != null and departmentId !=''">
|
|
|
- INNER join (select id
|
|
|
- from admin
|
|
|
- where department_id=#{departmentId,jdbcType=VARCHAR}) d on a.aid = d.id
|
|
|
- </if>
|
|
|
- where a.type = 1 and a.status =0 and a.source in (1,2,3)
|
|
|
+ inner join (SELECT DISTINCT uid FROM user_names
|
|
|
<if test="role == 0">
|
|
|
<if test="names !=null">
|
|
|
- and un.name in
|
|
|
+ WHERE name in
|
|
|
<foreach close=")" collection="names" item="name" open="(" separator=",">
|
|
|
#{name}
|
|
|
</foreach>
|
|
|
@@ -419,9 +413,17 @@
|
|
|
is null
|
|
|
</if>
|
|
|
</if>
|
|
|
- <if test="role == 1 and name != null">
|
|
|
- and un.name like concat('%', #{name},'%')
|
|
|
- </if>
|
|
|
+ <if test="role == 1 and name != null">
|
|
|
+ WHERE name like concat('%', #{name},'%')
|
|
|
+ </if>
|
|
|
+ ) un on a.id=un.uid
|
|
|
+ left join organization_identity b on a.id = b.uid
|
|
|
+ <if test="departmentId != null and departmentId !=''">
|
|
|
+ INNER join (select id
|
|
|
+ from admin
|
|
|
+ where department_id=#{departmentId,jdbcType=VARCHAR}) d on a.aid = d.id
|
|
|
+ </if>
|
|
|
+ where a.type = 1 and a.status =0 and a.source in (1,2,3)
|
|
|
<if test="aid != null and aid !=''">
|
|
|
and a.aid = #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|