Browse Source

update

Signed-off-by: anderx <312518615@qq.com>
anderx 5 years ago
parent
commit
4604b3d873

+ 32 - 10
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -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 &lt; 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 &lt; 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},'%')

+ 12 - 0
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -3,6 +3,7 @@ package com.goafanti.customer.service.impl;
 import java.lang.reflect.InvocationTargetException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -178,13 +179,24 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		Map<String,Object> params = disposeParams(cli);
 		params.put("sort", sort);
 		params.put("sortType",sortType);
+		List<String> alist=new ArrayList<>();
 		if (type==0||TokenManager.hasRole(AFTConstants.SALESMAN)) {
 			params.put("power", 0);
 		}else if (TokenManager.hasRole(AFTConstants.SALESMAN_MANAGER)) {
 			params.put("power", 1);
+			alist=adminMapper.selectBySuperId(cli.getAid());
 		}else if (TokenManager.hasRole(AFTConstants.SALESMAN_DIRECTOR)) {
 			params.put("power", 2);
+			alist=adminMapper.selectBySuperId(cli.getAid());
+			List<String >alist2=new ArrayList<>();
+			if (!alist.isEmpty()) {
+				for (String string : alist) {
+					alist2.addAll(adminMapper.selectBySuperId(string));
+				}
+				alist.addAll(alist2);
+			}
 		}
+		params.put("alist", alist);
 		Pagination<CustomerListOut> list = (Pagination<CustomerListOut>) findPage("selectPrivateOrganizationCustomerList","selectPrivateOrganizationCustomerCount",params,pageNo,pageSize);
 		List<CustomerListOut> tmpList = (List<CustomerListOut>)list.getList();
 		setCustomerList(tmpList,0,type);

+ 1 - 1
src/main/resources/props/config_local.properties

@@ -5,7 +5,7 @@ jdbc.driverClassName=com.mysql.jdbc.Driver
 #jdbc.username=dev
 #jdbc.password=123456
 #测试
-jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+jdbc.url=jdbc:mysql://101.37.32.31:3306/aft20201022?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 jdbc.username=root
 jdbc.password=aftdev
 #\u68c0\u6d4b\u6570\u636e\u5e93\u94fe\u63a5\u662f\u5426\u6709\u6548\uff0c\u5fc5\u987b\u914d\u7f6e