Browse Source

业绩目标添加区域排除有下级的区域

hu 1 year ago
parent
commit
9d7a4e0008

+ 3 - 3
src/custom/restcontroller/webmanage/sale/salestarget/SQL/通用-人员范围查询.sql

@@ -1,8 +1,8 @@
 SELECT distinct
-			 t1.sa_saleareaid,
-			 t1.areaname
+    t1.sa_saleareaid,
+    t1.areaname
 FROM sa_salearea t1
-WHERE t1.siteid = $siteid$ and ifnull(t1.sa_saleareaid,0)!=0 and t1.areaname not in('销售部','来斯奥') and t1.parentid!=0
+WHERE t1.siteid = $siteid$ and ifnull(t1.sa_saleareaid,0)!=0 and not exists (select * from sa_salearea where parentid=t1.sa_saleareaid) and t1.parentid!=0
   AND $where$
   AND t1.sa_saleareaid $isIn$
       (SELECT sa_saleareaid FROM sa_salestargethr WHERE sa_salestargetbillid = $sa_salestargetbillid$ AND siteid = $siteid$)