44323
2023-11-14 ddbb38c54db9c3670e5ff53f4bf713525de1099d
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/RoleController.java
@@ -96,8 +96,9 @@
        if (Objects.isNull(roleId)) {
            throw new GunsException(BizExceptionEnum.REQUEST_NULL);
        }
        Role role = roleService.getById(roleId);
        model.addAttribute("roleId", roleId);
        model.addAttribute("roleName", ConstantFactory.me().getSingleRoleName(roleId));
        model.addAttribute("roleName", role.getName());
        return PREFIX + "/role_assign.html";
    }
@@ -124,6 +125,8 @@
            throw new GunsException(BizExceptionEnum.REQUEST_NULL);
        }
        role.setId(null);
        role.setObjType(UserExt.getUser().getObjectType());
        role.setObjId(UserExt.getUser().getObjectId());
        this.roleService.save(role);
@@ -215,7 +218,7 @@
    @RequestMapping(value = "/roleTreeList")
    @ResponseBody
    public List<ZTreeNode> roleTreeList() {
        List<ZTreeNode> roleTreeList = this.roleService.roleTreeList();
        List<ZTreeNode> roleTreeList = this.roleService.roleTreeList(UserExt.getUser().getObjectType(),UserExt.getUser().getObjectId());
        roleTreeList.add(ZTreeNode.createParent());
        return roleTreeList;
    }
@@ -228,12 +231,14 @@
    public List<ZTreeNode> roleTreeListByUserId(@PathVariable Integer userId) {
        User theUser = this.userService.getById(userId);
        String roleid = theUser.getRoleid();
        Integer objectType = UserExt.getUser().getObjectType();
        Integer objectId = UserExt.getUser().getObjectId();
        if (Objects.isNull(roleid)) {
            List<ZTreeNode> roleTreeList = this.roleService.roleTreeList();
            List<ZTreeNode> roleTreeList = this.roleService.roleTreeList(objectType,objectId);
            return roleTreeList;
        } else {
            String[] strArray = Convert.toStrArray(",", roleid);
            List<ZTreeNode> roleTreeListByUserId = this.roleService.roleTreeListByRoleId(strArray);
            List<ZTreeNode> roleTreeListByUserId = this.roleService.roleTreeListByRoleId(strArray,objectType,objectId);
            return roleTreeListByUserId;
        }
    }