refactor(permission-tree): 增加支持是否过滤子节点
This commit is contained in:
parent
3872f8cd00
commit
1227e0a94f
@ -48,4 +48,7 @@ public class PermissionPointTreeQueryReq {
|
|||||||
|
|
||||||
/** featureType 层级过滤-过滤掉featureType大于该值的数据 **/
|
/** featureType 层级过滤-过滤掉featureType大于该值的数据 **/
|
||||||
private Integer maxFeatureType;
|
private Integer maxFeatureType;
|
||||||
|
|
||||||
|
/** 节点匹配后是否继续匹配子节点 **/
|
||||||
|
private boolean fiterChildren = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -243,13 +243,14 @@ public class PermissionPointServiceImpl implements PermissionPointService {
|
|||||||
//条件匹配 - ID
|
//条件匹配 - ID
|
||||||
boolean matchId = CollectionUtil.isEmpty(request.getIds()) || request.getIds().contains(node.getPermissionPointId());
|
boolean matchId = CollectionUtil.isEmpty(request.getIds()) || request.getIds().contains(node.getPermissionPointId());
|
||||||
|
|
||||||
if (matchKeyword && matchDelegateType && matchId) {
|
boolean matched = matchKeyword && matchDelegateType && matchId;
|
||||||
//如果匹配直接返回,否则过滤子节点
|
if (matched && !request.isFiterChildren()) {
|
||||||
|
//如果匹配且不需要过滤子节点,直接返回,否则过滤子节点
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollectionUtil.isEmpty(node.getChildren())) {
|
if (CollectionUtil.isEmpty(node.getChildren())) {
|
||||||
return false;
|
return matched;
|
||||||
}
|
}
|
||||||
//过滤子节点 - 递归 - 必要时改为循环
|
//过滤子节点 - 递归 - 必要时改为循环
|
||||||
List<PermissionPointTreeNode> filterChildren = node.getChildren().stream()
|
List<PermissionPointTreeNode> filterChildren = node.getChildren().stream()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user