feat:(REQ-2699) 菜单权限树tree接口增加是否排除默认权限的入参,因为不是所有需求都需要

This commit is contained in:
lilong 2024-08-14 16:53:34 +08:00
parent 494bebc84d
commit 08a1e556fe
2 changed files with 12 additions and 2 deletions

View File

@ -68,4 +68,9 @@ public class TreePermissionReq {
* 菜单跟页面元素绑定的类型
*/
private Set<PageElementFeatureResourceRelationTypeEnum> pageElementTypes;
/**
* 默认会增加config配置的默认权限不需要就传true
*/
private Boolean excludeDefaultPermission;
}

View File

@ -312,7 +312,12 @@ public class PermissionQueryServiceImpl implements PermissionQueryService {
* 所以做了一个开关可以配置所有用户可以看到的菜单
* @return
*/
private Set<Long> listNotAuthFeatureIds() {
private Set<Long> listNotAuthFeatureIds(TreePermissionReq req) {
if (BooleanUtils.isTrue(req.getExcludeDefaultPermission())) {
return Collections.emptySet();
}
if (CollectionUtils.isEmpty(notAuthUniCodes)) {
return Collections.emptySet();
}
@ -446,7 +451,7 @@ public class PermissionQueryServiceImpl implements PermissionQueryService {
Set<Long> allFeatureIds = Sets.newHashSet();
Set<Long> featureIds = resovlePermission(req);
Set<Long> defaultFeatureIds = listNotAuthFeatureIds();
Set<Long> defaultFeatureIds = listNotAuthFeatureIds(req);
allFeatureIds.addAll(featureIds);
allFeatureIds.addAll(defaultFeatureIds);