use of io.github.tesla.ops.system.domain.DeptDO in project tesla by linking12.
the class UserServiceImpl method getTree.
@Override
public Tree<DeptDO> getTree() {
List<Tree<DeptDO>> trees = new ArrayList<Tree<DeptDO>>();
List<DeptDO> depts = deptMapper.list(new HashMap<String, Object>(16));
Long[] pDepts = deptMapper.listParentDept();
Long[] uDepts = userMapper.listAllDept();
Long[] allDepts = (Long[]) ArrayUtils.addAll(pDepts, uDepts);
for (DeptDO dept : depts) {
if (!ArrayUtils.contains(allDepts, dept.getDeptId())) {
continue;
}
Tree<DeptDO> tree = new Tree<DeptDO>();
tree.setId(dept.getDeptId().toString());
tree.setParentId(dept.getParentId().toString());
tree.setText(dept.getName());
Map<String, Object> state = new HashMap<>(16);
state.put("opened", true);
state.put("mType", "dept");
tree.setState(state);
trees.add(tree);
}
List<UserDO> users = userMapper.list(new HashMap<String, Object>(16));
for (UserDO user : users) {
Tree<DeptDO> tree = new Tree<DeptDO>();
tree.setId(user.getUserId().toString());
tree.setParentId(user.getDeptId().toString());
tree.setText(user.getName());
Map<String, Object> state = new HashMap<>(16);
state.put("opened", true);
state.put("mType", "user");
tree.setState(state);
trees.add(tree);
}
Tree<DeptDO> t = BuildTree.build(trees);
return t;
}
use of io.github.tesla.ops.system.domain.DeptDO in project tesla by linking12.
the class DeptController method edit.
@GetMapping("/edit/{deptId}")
@RequiresPermissions("sys:dept:edit")
String edit(@PathVariable("deptId") Long deptId, Model model) {
DeptDO sysDept = sysDeptService.get(deptId);
model.addAttribute("sysDept", sysDept);
if (Constant.DEPT_ROOT_ID.equals(sysDept.getParentId())) {
model.addAttribute("parentDeptName", "无");
} else {
DeptDO parDept = sysDeptService.get(sysDept.getParentId());
model.addAttribute("parentDeptName", parDept.getName());
}
return prefix + "/edit";
}
use of io.github.tesla.ops.system.domain.DeptDO in project tesla by linking12.
the class DeptServiceImpl method getTree.
@Override
public Tree<DeptDO> getTree() {
List<Tree<DeptDO>> trees = new ArrayList<Tree<DeptDO>>();
List<DeptDO> sysDepts = sysDeptMapper.list(new HashMap<String, Object>(16));
for (DeptDO sysDept : sysDepts) {
Tree<DeptDO> tree = new Tree<DeptDO>();
tree.setId(sysDept.getDeptId().toString());
tree.setParentId(sysDept.getParentId().toString());
tree.setText(sysDept.getName());
Map<String, Object> state = new HashMap<>(16);
state.put("opened", true);
tree.setState(state);
trees.add(tree);
}
// 默认顶级菜单为0,根据数据库实际情况调整
Tree<DeptDO> t = BuildTree.build(trees);
return t;
}
Aggregations