Commit 828a7f01 by huangjinxin

fix:构建资源树

1 parent 7161058b
......@@ -283,9 +283,13 @@ public class RoleService {
List<ResourceInfo> collect = all.stream().filter(resourceEntity -> StringUtils.isBlank(resourceEntity.getParentId())).map(entity -> BeanUtil.copyProperties(entity, ResourceInfo.class)).collect(Collectors.toList());
for (ResourceInfo entity : collect) {
List<ResourceInfo> twoResource = all.stream().filter(resourceEntity -> entity.getParentId().equals(entity.getId())).map(e -> BeanUtil.copyProperties(e, ResourceInfo.class)).collect(Collectors.toList());
List<ResourceInfo> twoResource = all.stream().filter(resourceEntity -> StringUtils.isNotBlank(resourceEntity.getParentId())
&& resourceEntity.getParentId().equals(entity.getId()))
.map(e -> BeanUtil.copyProperties(e, ResourceInfo.class)).collect(Collectors.toList());
for (ResourceInfo twoEntity : twoResource) {
List<ResourceInfo> threeResource = all.stream().filter(resourceEntity -> entity.getParentId().equals(twoEntity.getId())).map(e -> BeanUtil.copyProperties(e, ResourceInfo.class)).collect(Collectors.toList());
List<ResourceInfo> threeResource = all.stream().filter(resourceEntity -> StringUtils.isNotBlank(resourceEntity.getParentId())
&& resourceEntity.getParentId().equals(twoEntity.getId()))
.map(e -> BeanUtil.copyProperties(e, ResourceInfo.class)).collect(Collectors.toList());
twoEntity.setChildren(threeResource);
}
entity.setChildren(twoResource);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!