|
|
@@ -236,31 +236,25 @@ from
|
|
|
|
|
|
<select id="privateCustomersDepCount" parameterType="String" resultType="com.goafanti.report.bo.CountDepMarketingStatisticsBo">
|
|
|
select
|
|
|
- sum(a.count2) as privateCustomersCount,
|
|
|
- sum(d.count3) as departmentNumber
|
|
|
-from
|
|
|
- (
|
|
|
+ sum( a.count2 ) as privateCustomersCount,
|
|
|
+ sum( b.count3 ) as departmentNumber 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
|
|
|
+ (select aid, count(id) as count1
|
|
|
+ from user
|
|
|
+ where aid is not null and aid != ''
|
|
|
group by
|
|
|
- a.id
|
|
|
+ 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
|
|
|
+ ) 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}
|