Pre Merge pull request !435 from zszdevelop/fix_dept_recursion_bug

This commit is contained in:
zszdevelop
2022-05-01 12:24:19 +00:00
committed by Gitee
6 changed files with 50 additions and 26 deletions

View File

@ -125,6 +125,11 @@
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -3,6 +3,8 @@ package com.ruoyi.common.core.domain;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.lang.tree.Tree;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysMenu;
@ -44,6 +46,16 @@ public class TreeSelect implements Serializable
this.label = menu.getMenuName();
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public TreeSelect(Tree<Long> dept) {
this.id = dept.getId();
this.label = dept.getName().toString();
List<Tree<Long>> children = dept.getChildren();
if (children != null && !children.isEmpty()) {
this.children = children.stream().map(TreeSelect::new).collect(Collectors.toList());
}
}
public Long getId()
{