|
|
@@ -411,36 +411,19 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="selectPrivateOrganizationCustomerList" resultType="com.goafanti.customer.bo.CustomerListOut">
|
|
|
- select a.id uid,a.aid,a.identify_name name,a.society_tag societyTag,a.`level`,b.name aName,dg1.name as province,dg2.name as city, a.guidance,
|
|
|
- dg3.name as area,d.contacts,d.contact_mobile as contactMobile,date_format(t0.last_sign_time,'%Y-%m-%d %H:%i:%S') lastSignTime,
|
|
|
- date_format(a.transfer_time,'%Y-%m-%d %H:%i:%S') as transferTime,
|
|
|
- date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTime,
|
|
|
- date_format(t1.last_follow_time,'%Y-%m-%d %H:%i:%S') lastFollowTime,
|
|
|
- if(a.transfer_time < t1.last_follow_time,t1.last_follow_time,a.transfer_time) as orderTime
|
|
|
- from user a left join admin b on a.aid=b.id
|
|
|
- left join organization_identity d on a.id = d.uid left join district_glossory dg1 on d.location_province = dg1.id
|
|
|
- left join district_glossory dg2 on d.location_city = dg2.id left join district_glossory dg3 on d.location_area = dg3.id
|
|
|
- <if test="power == 0">
|
|
|
- left join (select aid,uid,max(lock_time) last_sign_time from user_lock_release where aid= #{aid,jdbcType=VARCHAR} group by uid) t0 on a.id=t0.uid
|
|
|
- left join (select uid,aid,max(create_time) last_follow_time from user_follow where aid= #{aid,jdbcType=VARCHAR} group by uid) t1 on a.id=t1.uid
|
|
|
- </if>
|
|
|
- <if test="power == 1 or power==2">
|
|
|
- left join (select aid,uid,max(lock_time) last_sign_time from user_lock_release where aid in
|
|
|
- <foreach item="item" collection="alist" separator="," open="(" close=")" index="">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- group by aid,uid) t0 on a.id=t0.uid and a.aid=t0.aid
|
|
|
- left join (select uid,aid,max(create_time) last_follow_time from user_follow where aid in
|
|
|
- <foreach item="item" collection="alist" separator="," open="(" close=")" index="">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- group by aid,uid)t1 on a.id=t1.uid and a.aid=t1.aid
|
|
|
- </if>
|
|
|
- <if test="power == 3">
|
|
|
- left join (select aid,uid,max(lock_time) last_sign_time from user_lock_release group by aid,uid)t0 on a.id=t0.uid
|
|
|
- left join (select uid,aid,max(create_time) last_follow_time from user_follow group by aid,uid)t1 on a.id=t1.uid
|
|
|
- </if>
|
|
|
- where a.type= 1 and a.share_type=0 and source !=0
|
|
|
+ select a.id uid,a.aid,a.identify_name name,a.society_tag societyTag,a.`level`,b.name aName,dg1.name as province,dg2.name as city,
|
|
|
+ a.guidance, dg3.name as area,d.contacts,d.contact_mobile as contactMobile,
|
|
|
+ date_format(um.last_sign_time,'%Y-%m-%d %H:%i:%S') lastSignTime,
|
|
|
+ date_format(a.transfer_time,'%Y-%m-%d %H:%i:%S') as transferTime,
|
|
|
+ date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTime,
|
|
|
+ date_format(um.last_follow_time,'%Y-%m-%d %H:%i:%S') lastFollowTime,
|
|
|
+ if(a.transfer_time < um.last_follow_time,um.last_follow_time,a.transfer_time) as orderTime
|
|
|
+ from user a left join admin b on a.aid=b.id left join organization_identity d on a.id = d.uid
|
|
|
+ left join district_glossory dg1 on d.location_province = dg1.id
|
|
|
+ left join district_glossory dg2 on d.location_city = dg2.id
|
|
|
+ left join district_glossory dg3 on d.location_area = dg3.id
|
|
|
+ left join user_mid um on um.aid=a.aid and um.uid=a.id
|
|
|
+ where a.type= 1 and a.share_type=0 and a.source in(1,2,3)
|
|
|
<if test="power ==0">
|
|
|
and a.aid = #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
@@ -468,7 +451,7 @@
|
|
|
<if test="area != null">
|
|
|
and d.location_area = #{area,jdbcType=INTEGER}
|
|
|
</if>
|
|
|
- <if test="level != null">
|
|
|
+ <if test="level != null">
|
|
|
and a.level = #{level,jdbcType=INTEGER}
|
|
|
</if>
|
|
|
<if test="sort != 1">
|
|
|
@@ -482,14 +465,14 @@
|
|
|
</if>
|
|
|
<if test="page_sql != null">
|
|
|
${page_sql}
|
|
|
- </if>
|
|
|
+ </if>
|
|
|
</select>
|
|
|
<select id="selectPrivateOrganizationCustomerCount" resultType="java.lang.Integer">
|
|
|
select count(*)
|
|
|
from user a left join admin b on a.aid=b.id
|
|
|
left join organization_identity d on a.id = d.uid left join district_glossory dg1 on d.location_province = dg1.id
|
|
|
left join district_glossory dg2 on d.location_city = dg2.id left join district_glossory dg3 on d.location_area = dg3.id
|
|
|
- where a.type= 1 and a.share_type=0 and source !=0
|
|
|
+ where a.type= 1 and a.share_type=0 and a.source in(1,2,3)
|
|
|
<if test="power ==0">
|
|
|
and a.aid = #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
@@ -499,7 +482,6 @@
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
-
|
|
|
<if test="name != null and name != ''">
|
|
|
and a.identify_name like concat('%',#{name},'%')
|
|
|
</if>
|