Browse Source

私有客户列表处理

Signed-off-by: anderx <312518615@qq.com>
anderx 5 years ago
parent
commit
f6c0f84cc9
1 changed files with 7 additions and 2 deletions
  1. 7 2
      src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

+ 7 - 2
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -409,6 +409,7 @@
 			and b.location_area = #{area,jdbcType=INTEGER}
 		</if>
 	</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,
@@ -417,8 +418,14 @@
 			from user a left join admin b on  a.aid=b.id left join admin c on b.superior_id=c.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
+			</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 
+			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>
 			where a.type= 1 and a.share_type=0  and source !=0
 		<if test="power ==0">
 			and a.aid = #{aid,jdbcType=VARCHAR}
@@ -468,8 +475,6 @@
 			from user a left join admin b on  a.aid=b.id left join admin c on b.superior_id=c.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 (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
 			where a.type= 1 and a.share_type=0  and source !=0
 		<if test="power ==0">
 			and a.aid = #{aid,jdbcType=VARCHAR}