|
|
@@ -413,14 +413,24 @@
|
|
|
<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(t1.last_follow_time,'%Y-%m-%d %H:%i:%S') lastFollowTime,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,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 admin c on b.superior_id=c.id
|
|
|
+ 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 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 group by aid,uid)t1 on a.id=t1.uid and a.aid=t1.aid
|
|
|
+ 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 == 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
|
|
|
@@ -431,10 +441,16 @@
|
|
|
and a.aid = #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
<if test="power ==1">
|
|
|
- and b.superior_id= #{aid,jdbcType=VARCHAR}
|
|
|
+ and a.aid in
|
|
|
+ <foreach item="item" collection="alist" separator="," open="(" close=")" index="">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
</if>
|
|
|
<if test="power ==2">
|
|
|
- and (c.superior_id = #{aid,jdbcType=VARCHAR} or b.superior_id= #{aid,jdbcType=VARCHAR})
|
|
|
+ and a.aid in
|
|
|
+ <foreach item="item" collection="alist" separator="," open="(" close=")" index="">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
and a.identify_name like concat('%',#{name},'%')
|
|
|
@@ -472,7 +488,7 @@
|
|
|
</select>
|
|
|
<select id="selectPrivateOrganizationCustomerCount" resultType="java.lang.Integer">
|
|
|
select count(*)
|
|
|
- from user a left join admin b on a.aid=b.id left join admin c on b.superior_id=c.id
|
|
|
+ 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
|
|
|
@@ -480,10 +496,16 @@
|
|
|
and a.aid = #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
<if test="power ==1">
|
|
|
- and b.superior_id= #{aid,jdbcType=VARCHAR}
|
|
|
+ and a.aid in
|
|
|
+ <foreach item="item" collection="alist" separator="," open="(" close=")" index="">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
</if>
|
|
|
<if test="power ==2">
|
|
|
- and (c.superior_id = #{aid,jdbcType=VARCHAR} or b.superior_id= #{aid,jdbcType=VARCHAR})
|
|
|
+ and a.aid in
|
|
|
+ <foreach item="item" collection="alist" separator="," open="(" close=")" index="">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
and a.identify_name like concat('%',#{name},'%')
|