use of com.github.liuweijw.business.commons.tree.DeptTree in project fw-cloud-framework by liuweijw.
the class DeptServiceImpl method getDeptTree.
private List<DeptTree> getDeptTree(List<Dept> list, int rootId) {
List<DeptTree> treeList = new ArrayList<DeptTree>();
for (Dept dept : list) {
// 排除父节点和自己节点相同的数据
if (dept.getPid().intValue() == dept.getDeptId().intValue())
continue;
DeptTree node = new DeptTree();
node.setId(dept.getDeptId() + "");
node.setPid(dept.getPid() + "");
node.setName(dept.getDeptName());
node.setPos(dept.getPos());
treeList.add(node);
}
return TreeUtil.build(treeList, "0");
}
use of com.github.liuweijw.business.commons.tree.DeptTree in project fw-cloud-framework by liuweijw.
the class DeptServiceImpl method getDeptTreeList.
@Override
@Cacheable(key = "'dept_tree_list'", unless = "#result eq null")
public List<DeptTree> getDeptTreeList() {
QDept dept = QDept.dept;
List<Dept> list = this.queryFactory.selectFrom(dept).where(dept.statu.eq(0)).fetch();
if (null == list || list.size() == 0)
return new ArrayList<DeptTree>();
return getDeptTree(list, 0);
}