| | |
| | | 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; |
| | |
| | | public class RoleController extends BladeController { |
| | | |
| | | private final IRoleService roleService; |
| | | private final RoleMapper roleMapper; |
| | | |
| | | /** |
| | | * 详情 |
| | |
| | | @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)); |
| | | } |
| | | |
| | |
| | | @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); |
| | | } |
| | | |
| | |
| | | @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); |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * 自定义列表(只获取当前角色下级角色) |
| | | * |
| | | * @param roleParam |
| | | * @return |
| | | */ |