Forráskód Böngészése

未授权区域的区域经理查询不到数据看板的数据

hu 1 éve
szülő
commit
6569fe35bf

+ 3 - 0
src/custom/restcontroller/webmanage/sale/databoard/SQL/账号详情查询_角色列表.sql

@@ -0,0 +1,3 @@
+select t1.userid,t1.siteid,t1.roleid,t2.rolename,t2.remarks, t1.createdate, t1.createby from sys_userrole t1
+inner join sys_role t2 on t1.roleid=t2.roleid
+where t1.userid in $userid$ and t1.siteid=$siteid$ and t2.rolename='区域经理'

+ 40 - 6
src/custom/restcontroller/webmanage/sale/databoard/databoard.java

@@ -16,6 +16,7 @@ import org.apache.commons.lang.StringUtils;
 import restcontroller.R;
 import restcontroller.sale.promotion.promotion;
 import restcontroller.webmanage.sale.salestarget.personnel;
+import restcontroller.webmanage.users.users;
 
 import javax.annotation.processing.SupportedSourceVersion;
 import java.math.BigDecimal;
@@ -1274,20 +1275,36 @@ public class databoard extends Controller {
         areasqlFactory.addParameter("hrid", hrid);
         Rows arearows = dbConnect.runSqlQuery(areasqlFactory);
 
-
-        if(arearows.isNotEmpty() && arearows.size()>1){
+        SQLFactory roleSQL = new SQLFactory(this, "账号详情查询_角色列表");
+        roleSQL.addParameter_in("userid", userid);
+        roleSQL.addParameter("siteid", siteid);
+        Rows rolerows = dbConnect.runSqlQuery(roleSQL);
+        if(rolerows.isNotEmpty()){
             ArrayList<Long> arrayList =arearows.toArrayList("sa_saleareaid", new ArrayList<Long>());
             arrayList.addAll(SaleArea.getSubSaleAreaIds(this, arrayList));
             String sql ="";
             if(alias.equals("")){
-                 sql = " and sys_enterpriseid in (select sys_enterpriseid from sys_enterprise_tradefield where sa_saleareaid in "+arrayList+") ";
+                sql = " and sys_enterpriseid in (select sys_enterpriseid from sys_enterprise_tradefield where sa_saleareaid in "+arrayList+") ";
             }else{
-                 sql = " and "+alias+".sys_enterpriseid in (select sys_enterpriseid from sys_enterprise_tradefield where sa_saleareaid in "+arrayList+") ";
+                sql = " and "+alias+".sys_enterpriseid in (select sys_enterpriseid from sys_enterprise_tradefield where sa_saleareaid in "+arrayList+") ";
             }
 
             sql = sql.replace("[", "(").replace("]", ")");
             where=where+sql;
         }
+//        if(arearows.isNotEmpty() && arearows.size()>1){
+//            ArrayList<Long> arrayList =arearows.toArrayList("sa_saleareaid", new ArrayList<Long>());
+//            arrayList.addAll(SaleArea.getSubSaleAreaIds(this, arrayList));
+//            String sql ="";
+//            if(alias.equals("")){
+//                 sql = " and sys_enterpriseid in (select sys_enterpriseid from sys_enterprise_tradefield where sa_saleareaid in "+arrayList+") ";
+//            }else{
+//                 sql = " and "+alias+".sys_enterpriseid in (select sys_enterpriseid from sys_enterprise_tradefield where sa_saleareaid in "+arrayList+") ";
+//            }
+//
+//            sql = sql.replace("[", "(").replace("]", ")");
+//            where=where+sql;
+//        }
         return where;
     }
 
@@ -1298,8 +1315,11 @@ public class databoard extends Controller {
         areasqlFactory.addParameter("hrid", hrid);
         Rows arearows = dbConnect.runSqlQuery(areasqlFactory);
 
-
-        if(arearows.isNotEmpty() && arearows.size()>1){
+        SQLFactory roleSQL = new SQLFactory(this, "账号详情查询_角色列表");
+        roleSQL.addParameter_in("userid", userid);
+        roleSQL.addParameter("siteid", siteid);
+        Rows rolerows = dbConnect.runSqlQuery(roleSQL);
+        if(rolerows.isNotEmpty()){
             ArrayList<Long> arrayList =arearows.toArrayList("sa_saleareaid", new ArrayList<Long>());
             arrayList.addAll(SaleArea.getSubSaleAreaIds(this, arrayList));
             String sql ="";
@@ -1312,6 +1332,20 @@ public class databoard extends Controller {
             sql = sql.replace("[", "(").replace("]", ")");
             where=where+sql;
         }
+
+//        if(arearows.isNotEmpty() && arearows.size()>1){
+//            ArrayList<Long> arrayList =arearows.toArrayList("sa_saleareaid", new ArrayList<Long>());
+//            arrayList.addAll(SaleArea.getSubSaleAreaIds(this, arrayList));
+//            String sql ="";
+//            if(alias.equals("")){
+//                sql = " and sa_saleareaid in "+arrayList;
+//            }else{
+//                sql = " and "+alias+".sa_saleareaid in "+arrayList;
+//            }
+//
+//            sql = sql.replace("[", "(").replace("]", ")");
+//            where=where+sql;
+//        }
         return where;
     }