Merge remote-tracking branch 'origin/feature/REQ-1102' into feature/REQ-1102
This commit is contained in:
commit
7a80452c82
@ -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();
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ public class SaasRoleGroupDao extends ServiceImpl<SaasRoleGroupMapper, SaasRoleG
|
||||
public void delete(List<Long> id) {
|
||||
lambdaUpdate()
|
||||
.in(BaseEntity::getId,id)
|
||||
.set(BaseEntity::getIsDelete,id)
|
||||
.set(BaseEntity::getIsDelete,1l)
|
||||
.update();
|
||||
}
|
||||
|
||||
|
||||
@ -457,7 +457,7 @@ public class PermissionGroupImpl implements PermissionGroupService {
|
||||
.collect(Collectors.groupingBy(SaveOrUpdatePermissionGroupVO.PermissionGroupScopeVO::getType));
|
||||
List<SaveOrUpdatePermissionGroupVO.PermissionGroupScopeVO> includeScopes = Optional.ofNullable(selectedOuMap.get(PermissionScope.INCLUDE.getCode())).orElse(new ArrayList<>());
|
||||
List<SaveOrUpdatePermissionGroupVO.PermissionGroupScopeVO> excludeScopes = Optional.ofNullable(selectedOuMap.get(PermissionScope.EXCLUDE.getCode())).orElse(new ArrayList<>());
|
||||
if (includeScopes.size() + excludeScopes.size() != selectedWorkspace.size()) {
|
||||
if (includeScopes.size() + excludeScopes.size() != selectedOu.size()) {
|
||||
throw new BizException(BaseCode.BAD_REQUEST, "选择类型设置错误");
|
||||
}
|
||||
if (CollectionUtils.containsAny(includeScopes, excludeScopes)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user