|
|
@@ -641,37 +641,60 @@
|
|
|
</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(c.timeCount,0) as inputCount,
|
|
|
- ifnull(d.timeCount,0) as receiveCount, ifnull(e.completeCount,0)completeCount,ifnull(f.interviewCount,0)interviewCount
|
|
|
+ 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 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 timeCount from `user` where aid is not null
|
|
|
- and share_type=0 and source =1 and type=1
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
+ 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 =2 and type=1
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
- and transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
+ 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 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
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
- and a.update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
+ 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>
|
|
|
- and b.`type`=1 group by aid,uid)x group by aid)e on a.id=e.aid
|
|
|
- left join (select x.aid,count(uid) interviewCount from (select a.aid,a.uid from user_business a left join `user` b on a.uid=b.id where a.follow_situation=1
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
- and a.update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
+ 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>
|
|
|
- and b.`type`=1 group by aid,uid)x group by aid)f on a.id=f.aid
|
|
|
+ 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
|
|
|
+ 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">
|