| | |
| | | } |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构 |
| | | */ |
| | | @GetMapping("/lazy-trees") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "懒加载树形结构", notes = "树形结构") |
| | | public R<List<DeptVO>> lazyTrees(String tenantId, Long parentId, BladeUser bladeUser) { |
| | | List<DeptVO> tree = deptService.lazyTrees(Func.toStrWithEmpty(tenantId, bladeUser.getTenantId()), parentId); |
| | | return R.data(tree); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增或修改 |
| | | */ |
| | | @PostMapping("/submit") |
| | |
| | | */ |
| | | List<DeptVO> lazyTree(String tenantId, Long parentId); |
| | | |
| | | List<DeptVO> lazyTrees(String tenantId, Long parentId); |
| | | |
| | | /** |
| | | * 获取部门名 |
| | | * |
| | |
| | | ORDER BY dept.sort |
| | | </select> |
| | | |
| | | <select id="lazyTrees" resultMap="treeNodeResultMap" > |
| | | SELECT |
| | | dept.id, |
| | | dept.parent_id, |
| | | dept.dept_name AS title, |
| | | dept.id AS "value", |
| | | dept.id AS "key", |
| | | ( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 1 ELSE 0 END |
| | | FROM |
| | | blade_dept |
| | | WHERE |
| | | parent_id = dept.id and is_deleted = 0 |
| | | ) AS "has_children" |
| | | FROM |
| | | blade_dept dept |
| | | WHERE |
| | | dept.parent_id = #{param2} AND dept.is_deleted = 0 |
| | | and dept.tenant_id != 000000 |
| | | ORDER BY dept.sort |
| | | </select> |
| | | |
| | | <select id="getDeptNames" resultType="java.lang.String"> |
| | | SELECT |
| | | dept_name |
| | |
| | | */ |
| | | List<DeptVO> lazyTree(String tenantId, Long parentId); |
| | | |
| | | List<DeptVO> lazyTrees(String tenantId, Long parentId); |
| | | |
| | | /** |
| | | * 获取部门ID |
| | | * |
| | |
| | | } |
| | | return ForestNodeMerger.merge(baseMapper.lazyTree(tenantId, parentId)); |
| | | } |
| | | @Override |
| | | public List<DeptVO> lazyTrees(String tenantId, Long parentId) { |
| | | if (AuthUtil.isAdministrator()) { |
| | | tenantId = StringPool.EMPTY; |
| | | } |
| | | return ForestNodeMerger.merge(baseMapper.lazyTrees(tenantId, parentId)); |
| | | } |
| | | |
| | | @Override |
| | | public String getDeptIds(String tenantId, String deptNames) { |