소스 검색

角色选项限制功能

eganwu 1 년 전
부모
커밋
ca0f3a3b58

+ 2 - 1
src/custom/restcontroller/webmanage/role/RoleOptionLimit.java

@@ -77,9 +77,11 @@ public class RoleOptionLimit extends Controller {
 
     @API(title = "角色选项权限-列表", apiversion = R.ID20231201145502.v1.class)
     public String list() throws YosException {
+        Long roleid = content.getLongValue("roleid");
 
         SQLFactory sqlFactory = new SQLFactory(this, "角色选项限制查询列表", pageSize, pageNumber, pageSorting);
         sqlFactory.addParameter("siteid", siteid);
+        sqlFactory.addParameter("roleid", roleid);
         Rows rows = sqlFactory.runSqlQuery(dbConnect);
 
         String sql = "SELECT distinct optiontypeid,value from sys_optiontypemx WHERE optiontypeid in " + rows.toArrayList("optiontypeid");
@@ -88,7 +90,6 @@ public class RoleOptionLimit extends Controller {
         for (Row row : rows) {
             row.put("optiontypemx", optiontypemxMap.getOrDefault(row.getString("optiontypeid"), new Rows()).toArray("value"));
             Long optiontypeid = row.getLong("optiontypeid");
-            Long roleid = row.getLong("roleid");
             Rows valuerows = dbConnect.runSqlQuery("SELECT `value` from sys_role_optionlimit WHERE roleid=" + roleid + " and optiontypeid=" + optiontypeid);
             row.put("values", valuerows.toArray("value"));
         }

+ 6 - 5
src/custom/restcontroller/webmanage/role/SQL/角色选项限制查询列表.sql

@@ -1,8 +1,9 @@
 SELECT t1.*
 from (
-SELECT DISTINCT t1.roleid, t1.optiontypeid, t2.remarks optionttypename, t3.rolename
-from sys_role_optionlimit t1
-         LEFT JOIN sys_optiontype t2 ON t2.optiontypeid = t1.optiontypeid
-         LEFT JOIN sys_role t3 ON t3.roleid = t1.roleid
-where  t3.siteid=$siteid$
+         SELECT DISTINCT t1.roleid, t1.optiontypeid, t2.remarks optionttypename, t3.rolename
+         from sys_role_optionlimit t1
+                  LEFT JOIN sys_optiontype t2 ON t2.optiontypeid = t1.optiontypeid
+                  LEFT JOIN sys_role t3 ON t3.roleid = t1.roleid
+         where t3.siteid = $siteid$
+           and t1.roleid = $roleid$
      ) t1