Explorar o código

营销报表去处已转公共客户显示为私有客户数

anderx %!s(int64=7) %!d(string=hai) anos
pai
achega
a3a8c2bb5d

+ 7 - 2
src/main/java/com/goafanti/common/mapper/DailySalesReportMapper.xml

@@ -179,7 +179,7 @@
 		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 where aid is not null and aid != '' and share_type=0  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 != '' and share_type=0 and status != 1 group by aid)e
 		on a.id=e.aid left join admin f
 		on d.manager_id=f.id
 		where c.role_name in ('营销员' ,'营销经理','营销管理员')
@@ -257,6 +257,8 @@ from ( select
 			( select aid, count( aid ) as count1
 				from user 
 				where aid is not null and aid !=''
+				and share_type=0
+				and status != 1
 				group by aid
 			) y left join admin z on
 			y.aid = z.id
@@ -348,7 +350,8 @@ 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 (select aid,count(0) as privateCustomersCount from user group by aid)e
+	on b.rid=c.id left join (select aid,count(0) as privateCustomersCount from user where aid is not null and aid !=''
+				and share_type=0 and status != 1 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}
@@ -424,6 +427,8 @@ from ( select
 			( select aid, count( aid ) as count1
 				from user 
 				where aid is not null and aid !=''
+				and share_type=0
+				and status != 1
 				group by aid
 			) y left join admin z on
 			y.aid = z.id