|
|
@@ -1054,17 +1054,19 @@
|
|
|
<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
|
|
|
left join (select aid,count(aid) as userCount from user where aid is not null
|
|
|
- and share_type=0 and source !=0
|
|
|
+ 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 share_type=0 and source !=0 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 department d on a.department_id=d.id
|
|
|
- where a.status='正常'
|
|
|
- and b.userCount !=0
|
|
|
+ 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="depId != null">
|
|
|
and a.department_id = #{depId,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
@@ -1076,16 +1078,18 @@
|
|
|
<select id="selectAdminCustomerCount" parameterType="java.lang.String" resultType="java.lang.Integer">
|
|
|
select count(*) 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 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 share_type=0 and source !=0 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
|
|
|
- where a.status='正常'
|
|
|
- and b.userCount !=0
|
|
|
+ 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="depId != null">
|
|
|
and a.department_id = #{depId,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
@@ -1102,6 +1106,7 @@
|
|
|
and a.aid= #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
and a.share_type=0
|
|
|
+ and a.type=1
|
|
|
<if test="startTime != null and endTime != null">
|
|
|
and a.create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
@@ -1119,6 +1124,7 @@
|
|
|
and a.aid= #{aid,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
and a.share_type=0
|
|
|
+ and a.type=1
|
|
|
<if test="startTime != null and endTime != null">
|
|
|
and a.create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
</if>
|