Sfoglia il codice sorgente

查找当前登陆人操作的表对应的btn

shiqian 4 anni fa
parent
commit
accda366ad

+ 8 - 5
boman-web-core/src/main/java/com/boman/web/core/service/TableServiceCmdService.java

@@ -393,8 +393,8 @@ public class TableServiceCmdService {
         }
 
         jsonObject.put(FormDataConstant.QUERY_LIST, queryList);
-        // genTable.getMenuRole() 暂时数据库没有数据,
-        List<String> btns = buildBtnList();
+
+        List<String> btns = buildBtnList(genTable.getTableName());
         jsonObject.put(FormDataConstant.BUTTON_LIST, Strings.nullToEmpty(CollectionUtils.listToString(btns)));
         jsonObject.put(ViewTypeConst.VIEW_TYPE, Strings.nullToEmpty(genTable.getTplCategory()));
         jsonObject.put(RULES, packRequireColumn(columns));
@@ -402,11 +402,12 @@ public class TableServiceCmdService {
     }
 
     /**
-     * 功能描述: 查找当前登陆人对应的btn
+     * 功能描述: 查找当前登陆人操作的表对应的btn
      *
+     * @param tableName tableName
      * @return java.util.List<java.lang.String>
      */
-    private List<String> buildBtnList() {
+    private List<String> buildBtnList(String tableName) {
         List<SysMenu> menus = remoteMenuService.listBtnByUserId(SecurityUtils.getUserId());
         if (isEmpty(menus)) {
             return Collections.emptyList();
@@ -415,7 +416,9 @@ public class TableServiceCmdService {
         List<String> permses = map(menus, SysMenu::getPerms);
         ArrayList<String> btns = Lists.newArrayListWithCapacity(permses.size());
         for (String perms : permses) {
-            btns.add(RoleMenuDto.getBtnFromPerms(perms));
+            if (perms.contains(tableName)) {
+                btns.add(RoleMenuDto.getBtnFromPerms(perms));
+            }
         }
 
         return btns;