Browse Source

update

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

+ 3 - 2
src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java

@@ -383,10 +383,10 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 		acb.setInterviewCount(0);
 		acb.setReceiveCount(0);
 		acb.setUserCount(0);
-		acb.setaList(new ArrayList<>());
 		//迭代查出所有层级并计算
 		acb.setList(nestingList(deps,startTime,  endTime,aName));
 		//计算顶层
+		acb.setaList(organizationManagementMapper.getDepAll(acb.getName(),null,aName,startTime,  endTime));
 		sumCount(acb,0);
 		return acb;
 	}
@@ -450,7 +450,8 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 		if(pageSize==null||pageSize<0)pageSize=10;
 		if(pageNo==null||pageNo<0)pageNo=1;
 		if (StringUtils.isNotBlank(aid)) params.put("aid", aid);
-		if (type!=null) params.put("type", type);
+		if (type==null) params.put("type", 0);
+		else  params.put("type", type);
 		if (StringUtils.isNotBlank(startTime)) params.put("startTime", startTime);
 		if (StringUtils.isNotBlank(endTime)) params.put("endTime", endTime+" 23:59:59");
 		return (Pagination<AdminCustomerDetailBo>)findPage("selectAdminCustomerDetailList", "selectAdminCustomerDetailCount", params, pageNo, pageSize);

+ 58 - 43
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -1094,84 +1094,99 @@
   
    <select id="selectAdminCustomerDetailList"  resultType="com.goafanti.admin.bo.AdminCustomerDetailBo">
 select a.id,a.nickname as name,a.source,c.name contacts,c.mobile as contactMobile,
-	a.create_time as createTime,b.time_stamp as followTime,ifnull(d.update_time,e.update_time) updateTime
+	a.create_time as createTime,b.time_stamp as followTime
 	from user a 
 	left join (select uid,max(time_stamp) as time_stamp from user_follow group by uid) b  on a.id=b.uid
 	left join (select uid,name ,mobile from organization_contact_book where major=1) c on a.id=c.uid
-	left join (select uid,update_time from user_business where follow_situation=5)d  on a.id=d.uid
-	left join (select uid,update_time from user_business where follow_situation=6)e  on a.id=e.uid
-	where a.aid is not null and  a.share_type=0 and a.type=1
-    <if test="aid != null"> 
+	<if test="type==3 or type==4">
+	left join (select aid,uid from user_business
+	<if test="type==3">
+	where follow_situation=5 
+	</if> 
+	<if test="type==4">
+	where follow_situation=1
+	</if> 
+	<if test="startTime != null and endTime != null">
+		and  update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}  
+    </if>
+	group by aid,uid)d on a.id=d.uid
+	</if>
+	where  a.type=1
+    <if test=" type !=3 and type !=4 and aid != null"> 
 	and a.aid=  #{aid,jdbcType=VARCHAR}
     </if>
-    <if test="type==null">
-    and a.source in(1,2,3)
+    <if test=" (type ==3 or type ==4) and aid != null"> 
+	and d.aid=  #{aid,jdbcType=VARCHAR}
     </if>
-	<if test="type == 0">
+    <if test="type == 0">
+    and a.source in (1,2,3) 
+    </if>
+     <if test="type==0 or type==1 or type==2 ">
+    and  a.share_type=0
+    </if>
+	<if test="type == 1">
     and a.source =1
     <if test="startTime != null and endTime != null">
 	and  a.create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR} 
     </if>
     </if>
-    <if test="type == 1">
+    <if test="type == 2">
     and a.source =2
 	<if test="startTime != null and endTime != null">
 	and  a.transfer_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR} 
     </if>
     </if>
-    <if test="type == 2">
-    and d.follow_situation=5
-	<if test="startTime != null and endTime != null">
-		and  d.update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}  
-    </if>
-    </if>
-    <if test="type == 3">
-    and d.follow_situation=6
-    <if test="startTime != null and endTime != null">
-	and  e.update_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
-	</if>
-    </if>
    <if test="page_sql!=null">
 			${page_sql}
 	</if>
   </select>
   
   <select id="selectAdminCustomerDetailCount" parameterType="java.lang.String" resultType="java.lang.Integer">
-  	select count(*) from user a 
-  	left join (select uid,update_time,follow_situation from user_business where follow_situation=5)d  on a.id=d.uid
-	left join (select uid,update_time,follow_situation from user_business where follow_situation=6)e  on a.id=e.uid
-	where a.aid is not null and  a.share_type=0 and a.type=1
-	<if test="aid != null"> 
+  	select count(*) 
+  	from user a 
+	left join (select uid,max(time_stamp) as time_stamp from user_follow group by uid) b  on a.id=b.uid
+	left join (select uid,name ,mobile from organization_contact_book where major=1) c on a.id=c.uid
+	<if test="type==3 or type==4">
+	left join (select aid,uid from user_business
+	<if test="type==3">
+	where follow_situation=5 
+	</if> 
+	<if test="type==4">
+	where follow_situation=1
+	</if> 
+	<if test="startTime != null and endTime != null">
+		and  update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}  
+    </if>
+	group by aid,uid)d on a.id=d.uid
+	</if>
+	where  a.type=1
+    <if test=" type !=3 and type !=4 and aid != null"> 
 	and a.aid=  #{aid,jdbcType=VARCHAR}
     </if>
-    <if test="type==null">
-    and a.source in(1,2,3)
+    <if test=" (type ==3 or type ==4) and aid != null"> 
+	and d.aid=  #{aid,jdbcType=VARCHAR}
     </if>
-	<if test="type == 0">
-    and a.source =1
+    <if test="type == 0">
+    and a.source in (1,2,3) and  a.share_type=0
+    </if>
+     <if test="type==0 or type==1 or type==2 ">
+    and  a.share_type=0
+    </if>
+	<if test="type == 1">
+    and a.source =1  
     <if test="startTime != null and endTime != null">
 	and  a.create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR} 
     </if>
     </if>
-    <if test="type == 1">
+    <if test="type == 2">
     and a.source =2
 	<if test="startTime != null and endTime != null">
 	and  a.transfer_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR} 
     </if>
     </if>
-	<if test="type == 2">
-    and d.follow_situation=5
-	<if test="startTime != null and endTime != null">
-		and  d.update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}  
-    </if>
-    </if>
-    <if test="type == 3">
-    and e.follow_situation=6
-    <if test="startTime != null and endTime != null">
-	and  e.update_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
-	</if>
-    </if>
   </select>
+  
+  
   <select id="listNameByDepAndName" resultType="java.lang.String">
 	select a.id  from admin a left join user_role b on a.id =b.uid
 		left join `role` c on b.rid=c.id

+ 4 - 5
src/main/java/com/goafanti/common/mapper/OrganizationManagementMapper.xml

@@ -653,16 +653,16 @@
     and  transfer_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
 	group by aid) d on a.id=d.aid
-	left join (select aid,count(aid) completeCount from user_business a where follow_situation=5
+	left join (select x.aid,count(uid) completeCount from (select aid,uid from user_business a where follow_situation=5
 	  <if test="startTime != null and endTime != null"> 
     and  update_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
-	group by aid)e on a.id=e.aid 
-	left join (select aid,count(aid) interviewCount from user_business a where follow_situation=6
+	group by aid,uid)x group by aid)e on a.id=e.aid 
+	left join (select x.aid,count(uid)interviewCount from (select aid,uid from user_business a where follow_situation=1
 	  <if test="startTime != null and endTime != null"> 
     and  update_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
-	group by aid)f on a.id=e.aid
+	group by aid,uid)x group by aid)f on a.id=f.aid
 	left join department d on a.department_id=d.id
 	left join user_role e on a.id=e.uid
 	left join `role` f on e.rid=f.id
@@ -671,7 +671,6 @@
 	<if test="depName !=null">
 	and d.name= #{depName}
 	</if>
-	
 	<if test="adminName !=null">
 	and a.name  like concat('%',#{adminName},'%')  
 	</if>