From 8d637e54a1104e8e47093aef2fb2006e7f6533c6 Mon Sep 17 00:00:00 2001
From: xieb <vip_xiaobin810@163.com>
Date: Mon, 05 Jun 2023 21:26:19 +0800
Subject: [PATCH] 增加新菜单配置
---
skjcmanager/skjcmanager-service/skjcmanager-system/src/main/java/cn/gistack/system/controller/RoleController.java | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/skjcmanager/skjcmanager-service/skjcmanager-system/src/main/java/cn/gistack/system/controller/RoleController.java b/skjcmanager/skjcmanager-service/skjcmanager-system/src/main/java/cn/gistack/system/controller/RoleController.java
index 28d04c2..712fcf4 100644
--- a/skjcmanager/skjcmanager-service/skjcmanager-system/src/main/java/cn/gistack/system/controller/RoleController.java
+++ b/skjcmanager/skjcmanager-service/skjcmanager-system/src/main/java/cn/gistack/system/controller/RoleController.java
@@ -30,6 +30,7 @@
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.secure.constant.AuthConstant;
+import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
@@ -59,7 +60,7 @@
@AllArgsConstructor
@RequestMapping("/role")
@Api(value = "角色", tags = "角色")
-@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
+//@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public class RoleController extends BladeController {
private final IRoleService roleService;
@@ -87,6 +88,10 @@
@ApiOperation(value = "列表", notes = "传入role")
public R<List<RoleVO>> list(@ApiIgnore @RequestParam Map<String, Object> role, BladeUser bladeUser) {
QueryWrapper<Role> queryWrapper = Condition.getQueryWrapper(role, Role.class);
+ // 不是超级管理员,排除超级管理员查询
+ if (!AuthUtil.isAdministrator()){
+ queryWrapper.ne("ROLE_ALIAS", "administrator");
+ }
List<Role> list = roleService.list((!bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)) ? queryWrapper.lambda().eq(Role::getTenantId, bladeUser.getTenantId()) : queryWrapper);
return R.data(RoleWrapper.build().listNodeVO(list));
}
@@ -102,6 +107,14 @@
return R.data(tree);
}
+ @GetMapping("/treeByParentId")
+ @ApiOperationSupport(order = 3)
+ @ApiOperation(value = "树形结构", notes = "树形结构")
+ public R<List<RoleVO>> treeByParentId(String parentId) {
+ List<RoleVO> tree = roleService.treeByParentId(parentId);
+ return R.data(tree);
+ }
+
/**
* 获取指定角色树形结构
*/
--
Gitblit v1.9.3