吉安感知网项目-后端
linwei
2026-06-01 ae8e8fd2aac82eaa55814bedbb11ed4062a48a2c
drone-service/drone-system/src/main/java/org/sxkj/system/controller/RoleController.java
@@ -36,6 +36,7 @@
import org.springblade.core.tool.utils.Func;
import org.sxkj.system.cache.SysCache;
import org.sxkj.system.entity.Role;
import org.sxkj.system.mapper.RoleMapper;
import org.sxkj.system.service.IRoleService;
import org.sxkj.system.cache.UserCache;
import org.sxkj.system.entity.User;
@@ -66,6 +67,7 @@
public class RoleController extends BladeController {
   private final IRoleService roleService;
   private final RoleMapper roleMapper;
   /**
    * 详情
@@ -84,17 +86,16 @@
   @GetMapping("/list")
   @ApiImplicitParams({
      @ApiImplicitParam(name = "roleName", value = "参数名称", paramType = "query", dataType = "string"),
      @ApiImplicitParam(name = "roleAlias", value = "角色别名", paramType = "query", dataType = "string")
      @ApiImplicitParam(name = "roleAlias", value = "角色别名", paramType = "query", dataType = "string"),
      @ApiImplicitParam(name = "sysType", value = "系统编码 5:反无  6:工单", paramType = "query", dataType = "string")
   })
   @ApiOperationSupport(order = 2)
   @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("id","1123598816738675201");
      }
      List<Role> list = roleService.list(queryWrapper);
      String roleName = (String) role.get("roleName");
      String roleAlias = (String) role.get("roleAlias");
      String sysType = (String) role.get("sysType");
      List<Role> list = roleMapper.selectRoleList(roleName, roleAlias, sysType);
      return R.data(RoleWrapper.build().listNodeVO(list));
   }
@@ -104,8 +105,8 @@
   @GetMapping("/tree")
   @ApiOperationSupport(order = 3)
   @ApiOperation(value = "树形结构", notes = "树形结构")
   public R<List<RoleVO>> tree(String tenantId, BladeUser bladeUser) {
      List<RoleVO> tree = roleService.tree(Func.toStrWithEmpty(tenantId, bladeUser.getTenantId()));
   public R<List<RoleVO>> tree(@RequestParam(value = "tenantId") String tenantId, @RequestParam(value = "sysType", required = false) String sysType, BladeUser bladeUser) {
      List<RoleVO> tree = roleService.tree(Func.toStrWithEmpty(tenantId, bladeUser.getTenantId()), sysType);
      return R.data(tree);
   }
@@ -115,9 +116,9 @@
   @GetMapping("/tree-by-id")
   @ApiOperationSupport(order = 4)
   @ApiOperation(value = "树形结构", notes = "树形结构")
   public R<List<RoleVO>> treeById(Long roleId, BladeUser bladeUser) {
   public R<List<RoleVO>> treeById(Long roleId, @RequestParam(value = "sysType", required = false) String sysType, BladeUser bladeUser) {
      Role role = SysCache.getRole(roleId);
      List<RoleVO> tree = roleService.tree(Func.notNull(role) ? role.getTenantId() : bladeUser.getTenantId());
      List<RoleVO> tree = roleService.tree(Func.notNull(role) ? role.getTenantId() : bladeUser.getTenantId(), sysType);
      return R.data(tree);
   }
@@ -180,6 +181,7 @@
   /**
    * 自定义列表(只获取当前角色下级角色)
    *
    * @param roleParam
    * @return
    */