fix: 实体类添加自有接口
1.saasRoleVo添加权限过滤 2.菜单添加平铺展示
This commit is contained in:
parent
1b72a1c10c
commit
37f3a1de50
@ -1,10 +1,13 @@
|
||||
package cn.axzo.tyr.client.model.permission;
|
||||
|
||||
import cn.axzo.basics.common.model.IBaseTree;
|
||||
import cn.axzo.framework.domain.ServiceException;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -76,4 +79,30 @@ public class PermissionPointTreeNode implements IBaseTree<PermissionPointTreeNod
|
||||
public void setNodeChildren(List<PermissionPointTreeNode> nodeChildren) {
|
||||
this.children = nodeChildren;
|
||||
}
|
||||
/**
|
||||
* 将树型结构平铺展示。会将当前节点也添加到children中
|
||||
*/
|
||||
public void flatChildren() {
|
||||
if (CollectionUtil.isNotEmpty(children)) {
|
||||
this.children = getNode(new ArrayList<>(),children, 10);
|
||||
}
|
||||
}
|
||||
|
||||
private List<PermissionPointTreeNode> getNode(List<PermissionPointTreeNode> rootList,List<PermissionPointTreeNode> list,Integer maxDepth) {
|
||||
if (maxDepth < 1) {
|
||||
throw new ServiceException("超过最大递归深度,可能发生死循环");
|
||||
}
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
return rootList;
|
||||
}
|
||||
list.stream().forEach(e -> {
|
||||
getNode(rootList, e.getChildren(), maxDepth - 1);
|
||||
e.setChildren(null);
|
||||
} );
|
||||
|
||||
rootList.addAll(list);
|
||||
|
||||
|
||||
return rootList;
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,6 +82,7 @@ public class SaasRoleVO {
|
||||
// 通用权限
|
||||
if (CollectionUtil.isEmpty(permissionGroupVO.getScopes())) {
|
||||
permissionPoint.addAll(permissionGroupVO.getFeature());
|
||||
continue;
|
||||
}
|
||||
List<SaasRolePermissionScopeVO> scopes = permissionGroupVO.getScopes();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user