| | |
| | | return R.data(tree); |
| | | } |
| | | |
| | | @GetMapping("/treeByParentId") |
| | | @ApiOperationSupport(order = 10) |
| | | @ApiOperation(value = "树形结构", notes = "树形结构") |
| | | public R<List<DeptVO>> treeByParentId(String parentId) { |
| | | List<DeptVO> tree = deptService.treeByParentId(parentId); |
| | | return R.data(tree); |
| | | } |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构 |
| | | */ |
| | |
| | | */ |
| | | List<DeptVO> tree(String tenantId); |
| | | |
| | | List<DeptVO> treeByParentId(String parentId); |
| | | |
| | | /** |
| | | * 懒加载获取树形节点 |
| | | * |
| | |
| | | ORDER BY sort |
| | | </select> |
| | | |
| | | <select id="treeByParentId" resultMap="treeNodeResultMap"> |
| | | select id, parent_id, dept_name as title, id as "value", id as "key" from blade_dept where is_deleted = 0 |
| | | <if test="_parameter!=null and _parameter!=''"> |
| | | and ( |
| | | id = #{_parameter} or parent_id = #{_parameter} or parent_id in ( |
| | | select b.id from blade_dept b where b.is_deleted = 0 and b.PARENT_ID = #{_parameter} |
| | | ) |
| | | ) |
| | | </if> |
| | | ORDER BY sort |
| | | </select> |
| | | |
| | | <select id="lazyTree" resultMap="treeNodeResultMap" > |
| | | SELECT |
| | | dept.id, |
| | |
| | | * @return |
| | | */ |
| | | List<DeptVO> tree(String tenantId); |
| | | List<DeptVO> treeByParentId(String parentId); |
| | | |
| | | /** |
| | | * 懒加载树形结构 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<DeptVO> treeByParentId(String parentId) { |
| | | return ForestNodeMerger.merge(baseMapper.treeByParentId(parentId)); |
| | | } |
| | | |
| | | @Override |
| | | public List<DeptVO> lazyTree(String tenantId, Long parentId) { |
| | | if (AuthUtil.isAdministrator()) { |
| | | tenantId = StringPool.EMPTY; |