perf:调整获取自己的功能点
This commit is contained in:
@@ -4,7 +4,10 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.tiesheng.role.pojos.dao.*;
|
||||
import com.tiesheng.role.pojos.dto.*;
|
||||
import com.tiesheng.role.pojos.dto.GroupRxUpdateDTO;
|
||||
import com.tiesheng.role.pojos.dto.MenuListDTO;
|
||||
import com.tiesheng.role.pojos.dto.OwnerMenuDTO;
|
||||
import com.tiesheng.role.pojos.dto.OwnerPointDTO;
|
||||
import com.tiesheng.role.pojos.vo.GroupTypeDTO;
|
||||
import com.tiesheng.role.pojos.vo.RoleUserPageVO;
|
||||
import com.tiesheng.role.pojos.vo.ServiceMenuVO;
|
||||
@@ -284,13 +287,25 @@ public class RoleController {
|
||||
TokenBean tokenBean = TsTokenConfig.get();
|
||||
List<CoreRoleAuthority> allOwnerMenus = coreRoleService.getOwnerAuthorityLeafList(tokenBean.getId(), tokenBean.getRoleId());
|
||||
|
||||
String parentId;
|
||||
if (StrUtil.isNotEmpty(dto.getParentNo())) {
|
||||
CoreRoleAuthority selected = coreRoleService.getAuthorityMapper().selectOne(new QueryWrapper<CoreRoleAuthority>()
|
||||
.eq("no", dto.getParentNo())
|
||||
.eq("is_deleted", 0)
|
||||
.last("limit 1")
|
||||
);
|
||||
parentId = selected == null ? "" : selected.getId();
|
||||
} else {
|
||||
parentId = "";
|
||||
}
|
||||
|
||||
List<CoreRoleAuthority> collect = allOwnerMenus.stream()
|
||||
.filter(it -> Objects.equals(it.getType(), "point"))
|
||||
.filter(it -> it.getService().equals(dto.getService()))
|
||||
.filter(it -> it.getPlatform().equals(dto.getPlatform()))
|
||||
.filter(it -> {
|
||||
if (StrUtil.isNotEmpty(dto.getParent())) {
|
||||
return dto.getParent().equals(it.getParent());
|
||||
if (StrUtil.isNotEmpty(parentId)) {
|
||||
return parentId.equals(it.getParent());
|
||||
}
|
||||
return true;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
@@ -2,18 +2,17 @@ package com.tiesheng.role.pojos.dto;
|
||||
|
||||
public class OwnerPointDTO extends OwnerMenuDTO {
|
||||
|
||||
private String parent;
|
||||
private String parentNo;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// setter\getter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public String getParent() {
|
||||
return parent;
|
||||
public String getParentNo() {
|
||||
return parentNo;
|
||||
}
|
||||
|
||||
public void setParent(String parent) {
|
||||
this.parent = parent;
|
||||
public void setParentNo(String parentNo) {
|
||||
this.parentNo = parentNo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user