|
|
|
@ -1,5 +1,6 @@ |
|
|
|
|
package com.keyware.shandan.bianmu.service; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import com.keyware.shandan.bianmu.entity.DirectoryResource; |
|
|
|
@ -153,7 +154,7 @@ public class DirectoryTreeService { |
|
|
|
|
} |
|
|
|
|
Set<String> allowDirIds = dirPermissionService.getByReadPermis(SecurityUtil.getLoginSysUser()); |
|
|
|
|
Set<String> dirIds = allDir.stream().map(DirectoryVo::getId).filter(allowDirIds::contains).collect(Collectors.toSet()); |
|
|
|
|
//dirIds.add(DirectoryType.LINK_DIR == parent.getDirectoryType() ? parent.getResourceId() : parentId);
|
|
|
|
|
|
|
|
|
|
QueryWrapper<DirectoryResource> query = new QueryWrapper<>(); |
|
|
|
|
query.in("PARENT_ID", dirIds); |
|
|
|
|
if (StringUtils.hasText(text)) { |
|
|
|
@ -168,20 +169,30 @@ public class DirectoryTreeService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void allDirectoryByParent(DirectoryVo parent, HashSet<DirectoryVo> result) { |
|
|
|
|
String parentId = DirectoryType.LINK_DIR == parent.getDirectoryType() ? parent.getResourceId() : parent.getId(); |
|
|
|
|
if(DirectoryType.LINK_DIR == parent.getDirectoryType()){ |
|
|
|
|
if (DirectoryType.LINK_DIR == parent.getDirectoryType()) { |
|
|
|
|
DirectoryVo linkDir = directoryService.getById(parent.getResourceId()); |
|
|
|
|
if(linkDir != null){ |
|
|
|
|
if (linkDir != null) { |
|
|
|
|
result.add(linkDir); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
result.add(parent); |
|
|
|
|
} |
|
|
|
|
List<DirectoryVo> children = directoryService.childrenListByParent(parentId); |
|
|
|
|
children.forEach(dir -> { |
|
|
|
|
result.add(dir); |
|
|
|
|
allDirectoryByParent(dir, result); |
|
|
|
|
}); |
|
|
|
|
// 查询普通目录数据
|
|
|
|
|
result.addAll(dirListByParent(parent)); |
|
|
|
|
|
|
|
|
|
// 查询软连接目录数据
|
|
|
|
|
LambdaQueryWrapper<DirectoryVo> query = new LambdaQueryWrapper<>(); |
|
|
|
|
query.eq(DirectoryVo::getDirectoryType, DirectoryType.LINK_DIR) |
|
|
|
|
.likeRight(DirectoryVo::getDirectoryPath, parent.getDirectoryPath() + "/"); |
|
|
|
|
directoryService.list(query).forEach(dir -> result.addAll(dirListByParent(dir))); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<DirectoryVo> dirListByParent(DirectoryVo parent) { |
|
|
|
|
LambdaQueryWrapper<DirectoryVo> query = new LambdaQueryWrapper<>(); |
|
|
|
|
query.eq(DirectoryVo::getDirectoryType, DirectoryType.DIRECTORY) |
|
|
|
|
.likeRight(DirectoryVo::getDirectoryPath, parent.getDirectoryPath() + "/"); |
|
|
|
|
return directoryService.list(query); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static class DirectoryParentBuilder { |
|
|
|
|