|
|
@@ -1052,16 +1052,23 @@
|
|
|
|
|
|
|
|
|
<select id="selectAdminCustomerList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminCustomerBo">
|
|
|
- select a.id as aid,a.name as aName,d.name as depName,ifnull(b.userCount,0) as userCount,ifnull(c.timeCount,0) as timeCount from admin a
|
|
|
+ select a.id as aid,a.name as aName,d.name as depName,ifnull(b.userCount,0) as userCount,ifnull(c.timeCount,0) as inputCount,
|
|
|
+ ifnull(c.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
|
|
|
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 !=0 and type=1
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
+ 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">
|
|
|
and create_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}
|
|
|
+ </if>
|
|
|
+ group by aid) d on a.id=c.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
|
|
|
@@ -1076,20 +1083,28 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="selectAdminCustomerCount" parameterType="java.lang.String" resultType="java.lang.Integer">
|
|
|
- select count(*) from admin a
|
|
|
+ select a.id as aid,a.name as aName,d.name as depName,ifnull(b.userCount,0) as userCount,ifnull(c.timeCount,0) as inputCount,
|
|
|
+ ifnull(c.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
|
|
|
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 !=0 and type=1
|
|
|
- <if test="startTime != null and endTime != null">
|
|
|
+ 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">
|
|
|
and create_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}
|
|
|
+ </if>
|
|
|
+ group by aid) d on a.id=c.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='正常'
|
|
|
+ and a.status='正常'
|
|
|
<if test="depId != null">
|
|
|
and a.department_id = #{depId,jdbcType=VARCHAR}
|
|
|
</if>
|