|
|
@@ -167,98 +167,332 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="findmarketingStatisticsList" parameterType="String" resultType="com.goafanti.report.bo.marketingESBo">
|
|
|
- select a.id ,a.name,a.department_id as departmentId,d.name as departmentName,d.manager_id,f.name as departmentManagerName,
|
|
|
+ select t1.id,t1.name,t1.departmentId,t1.departmentName,t1.manager_id,t1.departmentManagerName,
|
|
|
+ t1.roleName,t1.privateCustomersCount,t1.entryTime,
|
|
|
+ t2.yearFollowNo,t2.yearVisitNo,t2.yearTelNo,
|
|
|
+ t2.monthFollowNo,t2.monthVisitNo,t2.monthTelNo,
|
|
|
+ t2.weeklyFollowNo,t2.weeklyVisitNo,t2.weeklyTelNo,
|
|
|
+ t2.dayFollowNo,t2.dayVisitNo,t2.dayTelNo
|
|
|
+ from(
|
|
|
+ select a.id as id,a.name as name,a.department_id as departmentId,d.name as departmentName,d.manager_id,f.name as departmentManagerName,
|
|
|
c.role_name as roleName,ifnull(e.privateCustomersCount,0)as privateCustomersCount,a.create_time as entryTime
|
|
|
from admin a left join user_role b
|
|
|
on a.id=b.uid left join role c
|
|
|
on b.rid=c.id left join department_management d
|
|
|
- on a.department_id=d.id left join (select aid,count(0) as privateCustomersCount from user group by aid)e
|
|
|
+ on a.department_id=d.id left join (select aid,count(0) as privateCustomersCount from user where aid is not null and aid != '' group by aid)e
|
|
|
on a.id=e.aid left join admin f
|
|
|
on d.manager_id=f.id
|
|
|
- where 1=1
|
|
|
- and (c.role_name='营销员' or c.role_name='营销经理'or c.role_name='营销管理员')
|
|
|
- <if test="depId != null">
|
|
|
+ where c.role_name in ('营销员' ,'营销经理','营销管理员')
|
|
|
+ <if test="depId != null">
|
|
|
and a.department_id = #{depId,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- order by a.name desc
|
|
|
+)t1
|
|
|
+left join (
|
|
|
+select x.aid,x.yearFollowNo,x.yearVisitNo,x.yearTelNo,
|
|
|
+ y.monthFollowNo,y.monthVisitNo,y.monthTelNo,
|
|
|
+ z.weeklyFollowNo,z.weeklyVisitNo,z.weeklyTelNo,
|
|
|
+ w.dayFollowNo,w.dayVisitNo,dayTelNo
|
|
|
+ from (
|
|
|
+select
|
|
|
+ aid,
|
|
|
+ count(0) as yearFollowNo,
|
|
|
+ ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as yearVisitNo,
|
|
|
+ ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as yearTelNo
|
|
|
+ from user_follow where 1=1
|
|
|
+ and create_time > #{yearStart,jdbcType=VARCHAR}
|
|
|
+ and create_time < #{yearEnd,jdbcType=VARCHAR}
|
|
|
+ group by aid
|
|
|
+)x left join (
|
|
|
+select
|
|
|
+ aid,
|
|
|
+ count(0) as monthFollowNo,
|
|
|
+ ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as monthVisitNo,
|
|
|
+ ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as monthTelNo
|
|
|
+ from user_follow where 1=1
|
|
|
+ and create_time > #{monthStart,jdbcType=VARCHAR}
|
|
|
+ and create_time < #{monthEnd,jdbcType=VARCHAR}
|
|
|
+ group by aid
|
|
|
+)y on x.aid = y.aid
|
|
|
+left join (
|
|
|
+select
|
|
|
+ aid,
|
|
|
+ count(0) as weeklyFollowNo,
|
|
|
+ ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as weeklyVisitNo,
|
|
|
+ ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as weeklyTelNo
|
|
|
+ from user_follow where 1=1
|
|
|
+ and create_time > #{weeklyStart,jdbcType=VARCHAR}
|
|
|
+ and create_time < #{weeklyEnd,jdbcType=VARCHAR}
|
|
|
+ group by aid
|
|
|
+)z on y.aid = z.aid
|
|
|
+left join (
|
|
|
+select
|
|
|
+ aid,
|
|
|
+ count(0) as dayFollowNo,
|
|
|
+ ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as dayVisitNo,
|
|
|
+ ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as dayTelNo
|
|
|
+ from user_follow where 1=1
|
|
|
+ and create_time > #{dayStart,jdbcType=VARCHAR}
|
|
|
+ and create_time < #{dayEnd,jdbcType=VARCHAR}
|
|
|
+ group by aid
|
|
|
+)w on y.aid = w.aid
|
|
|
+)t2 on t1.id = t2.aid
|
|
|
</select>
|
|
|
|
|
|
<select id="marketingDepStatisticsList" parameterType="String" resultType="com.goafanti.report.bo.marketingESBo">
|
|
|
- select
|
|
|
+ select t1.departmentId,t1.departmentName,t1.departmentManagerName,t1.privateCustomersCount,t1.departmentNumber,
|
|
|
+ t2.yearFollowNo,t2.yearVisitNo,t2.yearTelNo,
|
|
|
+ t2.monthFollowNo,t2.monthVisitNo,t2.monthTelNo,
|
|
|
+ t2.weeklyFollowNo,t2.weeklyVisitNo,t2.weeklyTelNo,
|
|
|
+ t2.dayFollowNo,t2.dayVisitNo,t2.dayTelNo ,
|
|
|
+ t2.dayFollowNo/t1.departmentNumber as dayAVG
|
|
|
+ from(select
|
|
|
a.department_id as departmentId,
|
|
|
b.name as departmentName,
|
|
|
- b.manager_id,
|
|
|
c.name as departmentManagerName,
|
|
|
a.count2 as privateCustomersCount,
|
|
|
d.count3 as departmentNumber
|
|
|
-from
|
|
|
- (
|
|
|
- select
|
|
|
+from ( select
|
|
|
z.department_id,
|
|
|
- sum( y.count1 ) as count2
|
|
|
- from
|
|
|
- (
|
|
|
- select
|
|
|
- a.id,
|
|
|
- count( a.id ) as count1
|
|
|
- from
|
|
|
- admin a left join user b on
|
|
|
- a.id = b.aid
|
|
|
- group by
|
|
|
- a.id
|
|
|
+ sum( y.count1 ) as count2 from
|
|
|
+ ( select aid, count( aid ) as count1
|
|
|
+ from user
|
|
|
+ where aid is not null and aid !=''
|
|
|
+ group by aid
|
|
|
) y left join admin z on
|
|
|
- y.id = z.id
|
|
|
+ y.aid = z.id
|
|
|
group by
|
|
|
z.department_id
|
|
|
) a left join department_management b
|
|
|
on a.department_id = b.id left join admin c
|
|
|
on b.manager_id=c.id left join (select department_id,count(0) as count3 from admin group by department_id)d
|
|
|
on a.department_id = d.department_id
|
|
|
- where 1=1
|
|
|
+ where a.department_id is not null
|
|
|
<if test="depId != null">
|
|
|
and a.department_id = #{depId,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- order by b.name desc
|
|
|
-
|
|
|
+)t1
|
|
|
+left join (
|
|
|
+select m.department_id as departmentId,sum(n.dayFollowNo)as dayFollowNo,sum(n.dayVisitNo)as dayVisitNo,sum(n.dayTelNo) as dayTelNo
|
|
|
+ ,sum(n.weeklyFollowNo)as weeklyFollowNo,sum(n.weeklyVisitNo)as weeklyVisitNo,sum(n.weeklyTelNo) as weeklyTelNo
|
|
|
+ ,sum(n.monthFollowNo)as monthFollowNo,sum(n.monthVisitNo)as monthVisitNo,sum(n.monthTelNo) as monthTelNo
|
|
|
+ ,sum(n.yearFollowNo)as yearFollowNo,sum(n.yearVisitNo)as yearVisitNo,sum(n.yearTelNo) as yearTelNo
|
|
|
+from admin m left join
|
|
|
+(select x.aid,x.yearFollowNo,x.yearVisitNo,x.yearTelNo,
|
|
|
+ y.monthFollowNo,y.monthVisitNo,y.monthTelNo,
|
|
|
+ z.weeklyFollowNo,z.weeklyVisitNo,z.weeklyTelNo,
|
|
|
+ w.dayFollowNo,w.dayVisitNo,dayTelNo
|
|
|
+ from (
|
|
|
+select
|
|
|
+ aid,
|
|
|
+ count(0) as yearFollowNo,
|
|
|
+ ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as yearVisitNo,
|
|
|
+ ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as yearTelNo
|
|
|
+ from user_follow where 1=1
|
|
|
+ and create_time > #{yearStart,jdbcType=VARCHAR}
|
|
|
+ and create_time < #{yearEnd,jdbcType=VARCHAR}
|
|
|
+ group by aid
|
|
|
+)x left join (
|
|
|
+select
|
|
|
+ aid,
|
|
|
+ count(0) as monthFollowNo,
|
|
|
+ ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as monthVisitNo,
|
|
|
+ ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as monthTelNo
|
|
|
+ from user_follow where 1=1
|
|
|
+ and create_time > #{monthStart,jdbcType=VARCHAR}
|
|
|
+ and create_time < #{monthEnd,jdbcType=VARCHAR}
|
|
|
+ group by aid
|
|
|
+)y on x.aid = y.aid
|
|
|
+left join (
|
|
|
+select
|
|
|
+ aid,
|
|
|
+ count(0) as weeklyFollowNo,
|
|
|
+ ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as weeklyVisitNo,
|
|
|
+ ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as weeklyTelNo
|
|
|
+ from user_follow where 1=1
|
|
|
+ and create_time > #{weeklyStart,jdbcType=VARCHAR}
|
|
|
+ and create_time < #{weeklyEnd,jdbcType=VARCHAR}
|
|
|
+ group by aid
|
|
|
+)z on y.aid = z.aid
|
|
|
+left join (
|
|
|
+select
|
|
|
+ aid,
|
|
|
+ count(0) as dayFollowNo,
|
|
|
+ ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as dayVisitNo,
|
|
|
+ ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as dayTelNo
|
|
|
+ from user_follow where 1=1
|
|
|
+ and create_time > #{dayStart,jdbcType=VARCHAR}
|
|
|
+ and create_time < #{dayEnd,jdbcType=VARCHAR}
|
|
|
+ group by aid
|
|
|
+)w on y.aid = w.aid) n on m.id=n.aid
|
|
|
+where m.department_id is not null and m.department_id !=''
|
|
|
+group by m.department_id
|
|
|
+)t2 on t1.departmentId = t2.departmentId
|
|
|
+ORDER by t1.departmentName
|
|
|
</select>
|
|
|
<select id="privateCustomersCount" parameterType="string" resultType="com.goafanti.report.bo.CountMarketingStatisticsBo">
|
|
|
- select sum(e.privateCustomersCount) as privateCustomersCount
|
|
|
+ select SUM( n.privateCustomersCount )as privateCustomersCount,
|
|
|
+ SUM( m.dayFollowNo )as dayFollowNo,
|
|
|
+ SUM( m.dayVisitNo )as dayVisitNo,
|
|
|
+ SUM( m.dayTelNo )as dayTelNo,
|
|
|
+ SUM( m.weeklyFollowNo )as weeklyFollowNo,
|
|
|
+ SUM( m.weeklyVisitNo )as weeklyVisitNo,
|
|
|
+ SUM( m.weeklyTelNo )as weeklyTelNo,
|
|
|
+ SUM( m.monthFollowNo )as monthFollowNo,
|
|
|
+ SUM( m.monthVisitNo )as monthVisitNo,
|
|
|
+ SUM( m.monthTelNo )as monthTelNo,
|
|
|
+ SUM( m.yearFollowNo )as yearFollowNo,
|
|
|
+ SUM( m.yearVisitNo )as yearVisitNo,
|
|
|
+ SUM( m.yearTelNo )as yearTelNo
|
|
|
+from(
|
|
|
+select a.id,sum(e.privateCustomersCount) as privateCustomersCount
|
|
|
from admin a left join user_role b
|
|
|
on a.id=b.uid left join role c
|
|
|
- on b.rid=c.id left join department_management d
|
|
|
- on a.department_id=d.id left join (select aid,count(0) as privateCustomersCount from user group by aid)e
|
|
|
- on a.id=e.aid where 1=1
|
|
|
+ on b.rid=c.id left join (select aid,count(0) as privateCustomersCount from user group by aid)e
|
|
|
+ on a.id=e.aid where c.role_name in ('营销员','营销经理','营销管理员')
|
|
|
<if test="depId != null">
|
|
|
- and a.department_id = #{depId,jdbcType=VARCHAR}
|
|
|
+ and a.department_id = #{depId,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- and (c.role_name='营销员' or c.role_name='营销经理'or c.role_name='营销管理员')
|
|
|
+ GROUP by a.id
|
|
|
+) n left join (
|
|
|
+select x.aid,x.yearFollowNo,x.yearVisitNo,x.yearTelNo,
|
|
|
+ y.monthFollowNo,y.monthVisitNo,y.monthTelNo,
|
|
|
+ z.weeklyFollowNo,z.weeklyVisitNo,z.weeklyTelNo,
|
|
|
+ w.dayFollowNo,w.dayVisitNo,dayTelNo
|
|
|
+ from (
|
|
|
+select
|
|
|
+ aid,
|
|
|
+ count(0) as yearFollowNo,
|
|
|
+ ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as yearVisitNo,
|
|
|
+ ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as yearTelNo
|
|
|
+ from user_follow where 1=1
|
|
|
+ and create_time > #{yearStart,jdbcType=VARCHAR}
|
|
|
+ and create_time < #{yearEnd,jdbcType=VARCHAR}
|
|
|
+ group by aid
|
|
|
+)x left join (
|
|
|
+select
|
|
|
+ aid,
|
|
|
+ count(0) as monthFollowNo,
|
|
|
+ ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as monthVisitNo,
|
|
|
+ ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as monthTelNo
|
|
|
+ from user_follow where 1=1
|
|
|
+ and create_time > #{monthStart,jdbcType=VARCHAR}
|
|
|
+ and create_time < #{monthEnd,jdbcType=VARCHAR}
|
|
|
+ group by aid
|
|
|
+)y on x.aid = y.aid
|
|
|
+left join (
|
|
|
+select
|
|
|
+ aid,
|
|
|
+ count(0) as weeklyFollowNo,
|
|
|
+ ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as weeklyVisitNo,
|
|
|
+ ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as weeklyTelNo
|
|
|
+ from user_follow where 1=1
|
|
|
+ and create_time > #{weeklyStart,jdbcType=VARCHAR}
|
|
|
+ and create_time < #{weeklyEnd,jdbcType=VARCHAR}
|
|
|
+ group by aid
|
|
|
+)z on y.aid = z.aid
|
|
|
+left join (
|
|
|
+select
|
|
|
+ aid,
|
|
|
+ count(0) as dayFollowNo,
|
|
|
+ ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as dayVisitNo,
|
|
|
+ ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as dayTelNo
|
|
|
+ from user_follow where 1=1
|
|
|
+ and create_time > #{dayStart,jdbcType=VARCHAR}
|
|
|
+ and create_time < #{dayEnd,jdbcType=VARCHAR}
|
|
|
+ group by aid
|
|
|
+)w on y.aid = w.aid
|
|
|
+)m on n.id=m.aid
|
|
|
</select>
|
|
|
|
|
|
<select id="privateCustomersDepCount" parameterType="String" resultType="com.goafanti.report.bo.CountDepMarketingStatisticsBo">
|
|
|
- select
|
|
|
- sum( a.count2 ) as privateCustomersCount,
|
|
|
- sum( b.count3 ) as departmentNumber from(
|
|
|
- select
|
|
|
+ select sum(t1.privateCustomersCount) as privateCustomersCount,sum(t1.departmentNumber) as departmentNumber,
|
|
|
+ sum(t2.yearFollowNo) as yearFollowNo,sum(t2.yearVisitNo) as yearVisitNo,sum(t2.yearTelNo) as yearTelNo,
|
|
|
+ sum(t2.monthFollowNo) as monthFollowNo,sum(t2.monthVisitNo) as monthVisitNo,sum(t2.monthTelNo) as monthTelNo,
|
|
|
+ sum(t2.weeklyFollowNo) as weeklyFollowNo,sum(t2.weeklyVisitNo) as weeklyVisitNo,sum(t2.weeklyTelNo) as weeklyTelNo,
|
|
|
+ sum(t2.dayFollowNo) as dayFollowNo,sum(t2.dayVisitNo) as dayVisitNo,sum(t2.dayTelNo) as dayTelNo
|
|
|
+ ,sum(t2.dayFollowNo)/sum(t1.departmentNumber) as dayAVG
|
|
|
+ from(select
|
|
|
+ a.department_id as departmentId,
|
|
|
+ b.name as departmentName,
|
|
|
+ c.name as departmentManagerName,
|
|
|
+ a.count2 as privateCustomersCount,
|
|
|
+ d.count3 as departmentNumber
|
|
|
+from ( select
|
|
|
z.department_id,
|
|
|
- sum( y.count1 ) as count2
|
|
|
- from
|
|
|
- (select aid, count(id) as count1
|
|
|
- from user
|
|
|
- where aid is not null and aid != ''
|
|
|
- group by
|
|
|
- aid
|
|
|
+ sum( y.count1 ) as count2 from
|
|
|
+ ( select aid, count( aid ) as count1
|
|
|
+ from user
|
|
|
+ where aid is not null and aid !=''
|
|
|
+ group by aid
|
|
|
) y left join admin z on
|
|
|
y.aid = z.id
|
|
|
group by
|
|
|
z.department_id
|
|
|
- ) a left join (
|
|
|
- SELECT department_id,count(0) as count3 from admin GROUP by department_id
|
|
|
-
|
|
|
- ) b on a.department_id = b.department_id
|
|
|
- where 1=1
|
|
|
-<if test="depId != null">
|
|
|
-and a.department_id = #{depId,jdbcType=VARCHAR}
|
|
|
-</if>
|
|
|
+ ) a left join department_management b
|
|
|
+ on a.department_id = b.id left join admin c
|
|
|
+ on b.manager_id=c.id left join (select department_id,count(0) as count3 from admin group by department_id)d
|
|
|
+ on a.department_id = d.department_id
|
|
|
+ where a.department_id is not null
|
|
|
+ <if test="depId != null">
|
|
|
+ and a.department_id = #{depId,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+)t1
|
|
|
+left join (
|
|
|
+select m.department_id as departmentId,sum(n.dayFollowNo)as dayFollowNo,sum(n.dayVisitNo)as dayVisitNo,sum(n.dayTelNo) as dayTelNo
|
|
|
+ ,sum(n.weeklyFollowNo)as weeklyFollowNo,sum(n.weeklyVisitNo)as weeklyVisitNo,sum(n.weeklyTelNo) as weeklyTelNo
|
|
|
+ ,sum(n.monthFollowNo)as monthFollowNo,sum(n.monthVisitNo)as monthVisitNo,sum(n.monthTelNo) as monthTelNo
|
|
|
+ ,sum(n.yearFollowNo)as yearFollowNo,sum(n.yearVisitNo)as yearVisitNo,sum(n.yearTelNo) as yearTelNo
|
|
|
+from admin m left join
|
|
|
+(select x.aid,x.yearFollowNo,x.yearVisitNo,x.yearTelNo,
|
|
|
+ y.monthFollowNo,y.monthVisitNo,y.monthTelNo,
|
|
|
+ z.weeklyFollowNo,z.weeklyVisitNo,z.weeklyTelNo,
|
|
|
+ w.dayFollowNo,w.dayVisitNo,dayTelNo
|
|
|
+ from (
|
|
|
+select
|
|
|
+ aid,
|
|
|
+ count(0) as yearFollowNo,
|
|
|
+ ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as yearVisitNo,
|
|
|
+ ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as yearTelNo
|
|
|
+ from user_follow where 1=1
|
|
|
+ and create_time > #{yearStart,jdbcType=VARCHAR}
|
|
|
+ and create_time < #{yearEnd,jdbcType=VARCHAR}
|
|
|
+ group by aid
|
|
|
+)x left join (
|
|
|
+select
|
|
|
+ aid,
|
|
|
+ count(0) as monthFollowNo,
|
|
|
+ ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as monthVisitNo,
|
|
|
+ ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as monthTelNo
|
|
|
+ from user_follow where 1=1
|
|
|
+ and create_time > #{monthStart,jdbcType=VARCHAR}
|
|
|
+ and create_time < #{monthEnd,jdbcType=VARCHAR}
|
|
|
+ group by aid
|
|
|
+)y on x.aid = y.aid
|
|
|
+left join (
|
|
|
+select
|
|
|
+ aid,
|
|
|
+ count(0) as weeklyFollowNo,
|
|
|
+ ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as weeklyVisitNo,
|
|
|
+ ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as weeklyTelNo
|
|
|
+ from user_follow where 1=1
|
|
|
+ and create_time > #{weeklyStart,jdbcType=VARCHAR}
|
|
|
+ and create_time < #{weeklyEnd,jdbcType=VARCHAR}
|
|
|
+ group by aid
|
|
|
+)z on y.aid = z.aid
|
|
|
+left join (
|
|
|
+select
|
|
|
+ aid,
|
|
|
+ count(0) as dayFollowNo,
|
|
|
+ ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as dayVisitNo,
|
|
|
+ ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as dayTelNo
|
|
|
+ from user_follow where 1=1
|
|
|
+ and create_time > #{dayStart,jdbcType=VARCHAR}
|
|
|
+ and create_time < #{dayEnd,jdbcType=VARCHAR}
|
|
|
+ group by aid
|
|
|
+)w on y.aid = w.aid) n on m.id=n.aid
|
|
|
+where m.department_id is not null and m.department_id !=''
|
|
|
+group by m.department_id
|
|
|
+)t2 on t1.departmentId = t2.departmentId
|
|
|
</select>
|
|
|
|
|
|
|
|
|
@@ -266,7 +500,7 @@ and a.department_id = #{depId,jdbcType=VARCHAR}
|
|
|
select a.id,a.name,d.name as departmentName,role_name as roleName,ifnull(e.telNo,0)as countTelNo,
|
|
|
ifnull(e.visitNo,0)as countVisitNo,ifnull(e.followNo,0)as countFollowNo
|
|
|
<if test="startTime !=null and endTime !=null">
|
|
|
- ,countFollowNo/datediff(#{endTime,jdbcType=VARCHAR},#{startTime,jdbcType=VARCHAR}) as AVG
|
|
|
+ ,e.followNo/datediff(#{endTime,jdbcType=VARCHAR},#{startTime,jdbcType=VARCHAR}) as dayAVG
|
|
|
</if>
|
|
|
from admin a left join user_role b on
|
|
|
a.id = b.uid left join role c on
|
|
|
@@ -292,16 +526,11 @@ select a.id,a.name,d.name as departmentName,role_name as roleName,ifnull(e.telNo
|
|
|
and a.create_time < #{endTime,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
GROUP BY a.aid)e on a.id=e.aid
|
|
|
- where
|
|
|
- 1 = 1
|
|
|
- and(
|
|
|
- c.role_name = '营销员'
|
|
|
- or c.role_name = '营销经理'
|
|
|
- or c.role_name = '营销管理员'
|
|
|
- )
|
|
|
+ where c.role_name in ('营销员','营销经理','营销管理员')
|
|
|
<if test="depId != null">
|
|
|
and a.department_id= #{depId,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
+ order by a.name
|
|
|
</select>
|
|
|
<select id="sometimeMarketingDepStatistics" parameterType="String" resultType="com.goafanti.report.bo.SomeTimeMarketingBo">
|
|
|
select
|