浏览代码

bug修复

wu 1 天之前
父节点
当前提交
707a5661ef
共有 2 个文件被更改,包括 12 次插入16 次删除
  1. 1 1
      src/custom/beans/datateam/DataTeam.java
  2. 11 15
      src/custom/beans/proxy/Proxy.java

+ 1 - 1
src/custom/beans/datateam/DataTeam.java

@@ -418,7 +418,7 @@ public class DataTeam {
             }
             case 8: {
                 str = "(" + alias + "." + controller.getuniquecolumnname(ownertable) + " in (select ownerid from sys_datateam where siteid='" + siteid + "' and isleader=1 and userid=" + userid + " and ownertable='" + ownertable + "'  )";
-                str = str + " or " + alias + "." + controller.getuniquecolumnname(ownertable) + " in(select ownerid from sys_datateam where siteid='" + siteid + "' and ((isleader=0 and userid=" + userid + ") or(isleader=1 and userid in (select userid from sys_userteam where siteid='" + siteid + "' and createuserid = " + userid + " and isproxy = 1)))  and ownertable='" + ownertable + "' ))";
+                str = str + " or " + alias + "." + controller.getuniquecolumnname(ownertable) + " in(select ownerid from sys_datateam where siteid='" + siteid + "' and ((isleader=0 and userid=" + userid + ") or(isleader=1 and userid in (select createuserid  from sys_userteam where siteid='" + siteid + "' and userid = " + userid + " and isproxy = 1)))  and ownertable='" + ownertable + "' ))";
                 break;
             }
             //我下属创建的

+ 11 - 15
src/custom/beans/proxy/Proxy.java

@@ -4,6 +4,7 @@ import common.BaseClass;
 import common.Controller;
 import common.YosException;
 import common.data.QuerySQL;
+import common.data.Rows;
 import common.data.SQLFactory;
 
 import java.util.ArrayList;
@@ -13,24 +14,19 @@ public class Proxy extends BaseClass {
 
     //获取当前账号的代理人
     public static ArrayList<Long> getProxyHrids(Controller controller) throws YosException {
-        QuerySQL querySQL = SQLFactory.createQuerySQL(controller, "sys_userteam", "userid")
-                .setTableAlias("t1");
-        querySQL.addJoinTable(JOINTYPE.left,"sys_hr","t2","t2.userid=t1.userid and t2.siteid=t1.siteid","hrid");
-        querySQL.setSiteid(controller.siteid);
-        querySQL.setWhere("t1.isproxy", 1);
-        querySQL.setWhere("t1.createuserid", controller.userid);
-        return querySQL.query().toArrayList("hrid", new ArrayList<>());
-
+        String Sql = "select t1.createuserid userid,t2.hrid from sys_userteam t1 " +
+                "inner join sys_hr t2 on t1.siteid = t2.siteid and t1.createuserid = t2.userid " +
+                "where t1.siteid = '" + controller.siteid + "' and t1.userid = '" + controller.userid + "' and t1.isproxy = '1'";
+        Rows rows = controller.dbConnect.runSqlQuery(Sql);
+        return rows.toArrayList("hrid", new ArrayList<>());
     }
 
     public static ArrayList<Long> getProxyUserids(Controller controller) throws YosException {
-        QuerySQL querySQL = SQLFactory.createQuerySQL(controller, "sys_userteam", "userid")
-                .setTableAlias("t1");
-        querySQL.setSiteid(controller.siteid);
-        querySQL.setWhere("t1.isproxy", 1);
-        querySQL.setWhere("t1.createuserid", controller.userid);
-        return querySQL.query().toArrayList("userid", new ArrayList<>());
-
+        String Sql = "select t1.createuserid userid,t2.hrid from sys_userteam t1 " +
+                "inner join sys_hr t2 on t1.siteid = t2.siteid and t1.createuserid = t2.userid " +
+                "where t1.siteid = '" + controller.siteid + "' and t1.userid = '" + controller.userid + "' and t1.isproxy = '1'";
+        Rows rows = controller.dbConnect.runSqlQuery(Sql);
+        return rows.toArrayList("userid", new ArrayList<>());
     }
 
 }