Prechádzať zdrojové kódy

fix 修复角色权限无法修改成功的问题

Yue 8 mesiacov pred
rodič
commit
52a265715a

+ 9 - 9
SERVER/VberAdminPlusV3/vber-modules/vber-system/src/main/java/com/vber/system/service/impl/SysRoleServiceImpl.java

@@ -367,16 +367,16 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
      */
     private int insertRoleMenu(SysRoleBo role) {
         int rows = 1;
-        // 新增角色与组织机构(数据权限)管理
-        List<SysRoleOrg> list = new ArrayList<>();
-        for (Long orgId : role.getOrgIds()) {
-            SysRoleOrg rd = new SysRoleOrg();
-            rd.setRoleId(role.getRoleId());
-            rd.setOrgId(orgId);
-            list.add(rd);
+        // 新增角色与菜单管理
+        List<SysRoleMenu> list = new ArrayList<>();
+        for (Long menuId : role.getMenuIds()) {
+            SysRoleMenu rm = new SysRoleMenu();
+            rm.setRoleId(role.getRoleId());
+            rm.setMenuId(menuId);
+            list.add(rm);
         }
         if (CollUtil.isNotEmpty(list)) {
-            rows = roleOrgMapper.insertBatch(list) ? list.size() : 0;
+            rows = roleMenuMapper.insertBatch(list) ? list.size() : 0;
         }
         return rows;
     }
@@ -389,7 +389,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
     private int insertRoleOrg(SysRoleBo role) {
         Long[] orgIds = role.getOrgIds();
         if (ArrayUtil.isEmpty(orgIds)) {
-            return 0;
+            return 1;
         }
         List<SysRoleOrg> roleOrgList = Arrays.stream(orgIds)
                 .map(orgId -> {