|
|
@@ -625,10 +625,15 @@
|
|
|
select id,name,dep_no from department where super_id in (#{superIds,jdbcType=VARCHAR})
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectBysuperName" resultType="com.goafanti.admin.bo.depCountBo">
|
|
|
+ <select id="selectBysuperId" resultType="com.goafanti.admin.bo.depCountBo">
|
|
|
select a.id ,a.name ,0 userCount,0 inputCount,0 receiveCount, 0 completeCount, 0 interviewCount
|
|
|
- from department a left join department b on a.super_id=b.id where b.name= #{superName,jdbcType=VARCHAR}
|
|
|
+ from department a left join department b on a.super_id=b.id where b.id= #{id}
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="selectBysuperName" resultType="com.goafanti.admin.bo.depCountBo">
|
|
|
+ select a.id ,a.name ,0 userCount,0 inputCount,0 receiveCount, 0 completeCount, 0 interviewCount
|
|
|
+ from department a left join department b on a.super_id=b.id where b.name= #{name}
|
|
|
+ </select>
|
|
|
|
|
|
<!-- 查询所有 -->
|
|
|
<select id="selectAllDeps" resultMap="BaseResultMap">
|
|
|
@@ -641,65 +646,29 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="getDepAll" resultType="com.goafanti.admin.bo.AdminCustomerBo">
|
|
|
- select a.id as aid,a.name as aName,d.id depId,d.name as depName,ifnull(b.userCount,0) as userCount,ifnull(qd.userCount,0) as channelCount,
|
|
|
- ifnull(c.userCount,0) as signCount,ifnull(d.timeCount,0) as newCount,ifnull(e.timeCount,0) as channelNewCount,
|
|
|
- ifnull(f.completeCount,0)completeCount,ifnull(g.completeCount,0)channelCompleteCount,ifnull(h.timeCount,0) as receiveCount
|
|
|
- from admin a
|
|
|
- left join (select aid,count(aid) as userCount from user where aid is not null
|
|
|
- and share_type=0 and source !=0 and type=1 and channel=0
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
- and create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- group by aid) b on a.id=b.aid
|
|
|
- left join (select aid,count(aid) as userCount from user where aid is not null
|
|
|
- and share_type=0 and source !=0 and type=1 and channel=1
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
- and create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- group by aid) qd on a.id=qd.aid
|
|
|
- left join (select aid,count(aid) as userCount from user where aid is not null
|
|
|
- and share_type=2 and source !=0 and type=1
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
- and transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- group by aid) c on a.id=c.aid
|
|
|
- left join (select aid,count(aid) as timeCount from `user` where aid is not null
|
|
|
- and share_type=0 and source =1 and type=1 and channel=0
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
- and create_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) as timeCount from `user` where aid is not null
|
|
|
- and share_type=0 and source =1 and type=1 and channel=1
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
- and create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- group by aid) e on a.id=e.aid
|
|
|
- left join (select x.aid,count(uid) completeCount from (select a.aid,a.uid from user_business a left join `user` b on a.uid=b.id where a.follow_situation=5 and b.channel=0
|
|
|
- and b.`type`=1
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
- and create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- group by aid,uid)x group by aid)f on a.id=f.aid
|
|
|
- left join (select x.aid,count(uid) completeCount from (select a.aid,a.uid from user_business a left join `user` b on a.uid=b.id where a.follow_situation=5 and b.channel=1
|
|
|
- and b.`type`=1
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
- and create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- group by aid,uid)x group by aid)g on a.id=g.aid
|
|
|
- left join (select aid,count(aid) as timeCount from `user` where aid is not null
|
|
|
- and share_type=0 and source =2 and type=1 and channel=0
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
- and transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- group by aid) h on a.id=h.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
|
|
|
- where f.role_name in ('营销员','营销经理')
|
|
|
- and a.status='正常'
|
|
|
- <if test="depName !=null">
|
|
|
- and d.name= #{depName}
|
|
|
- </if>
|
|
|
+ select a.id aid,a.name aName,d.id depId,d.name depName,b.userCount,b.channelCount,b.signCount,b.newCount,b.channelNewCount,b.receiveCount,
|
|
|
+ b.completeCount,b.channelCompleteCount
|
|
|
+ from admin a inner join (select x.aid,x.userCount,x.channelCount,signCount,x.newCount,x.channelNewCount,x.receiveCount,
|
|
|
+ ifnull(y.completeCount,0)completeCount,ifnull(y.channelCompleteCount,0)channelCompleteCount
|
|
|
+ from (select aid,sum(if( share_type=0 and channel=0,1,0))userCount,
|
|
|
+ sum(if(share_type=0 and channel=1,1,0))channelCount,
|
|
|
+ sum(if( share_type=2 ,1,0))signCount,
|
|
|
+ sum(if(share_type=0 and source =1 and channel=0,1,0))newCount,
|
|
|
+ sum(if(share_type=0 and source =1 and channel=1,1,0))channelNewCount,
|
|
|
+ sum(if(share_type=0 and source =2 and channel=0,1,0))receiveCount
|
|
|
+ from `user` where `type` =1
|
|
|
+ <if test="startTime != null and endTime != null">
|
|
|
+ and transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ group by aid)x left join (select a.aid,sum(if(b.channel=0,1,0))completeCount,
|
|
|
+ sum(if(b.channel=1,1,0))channelCompleteCount from public_release a left join `user` b on a.uid =b.id
|
|
|
+ where a.clock_in =1
|
|
|
+ <if test="startTime != null and endTime != null">
|
|
|
+ and clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ group by a.aid ) y on x.aid=y.aid)b on a.id=b.aid
|
|
|
+ left join department d on a.department_id=d.id
|
|
|
+ where 1=1
|
|
|
<if test="adminName !=null">
|
|
|
and a.name like concat('%',#{adminName},'%')
|
|
|
</if>
|
|
|
@@ -707,4 +676,5 @@
|
|
|
and d.id= #{depId}
|
|
|
</if>
|
|
|
</select>
|
|
|
+
|
|
|
</mapper>
|