SysOrgController.java
1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.youjia.system.controller;
import com.youjia.common.core.Result;
import com.youjia.system.service.SysOrgService;
import com.youjia.system.vo.TreeNodeVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 组织(后台维护,本期不提供管理界面)。
*/
@Tag(name = "系统设置 · 组织")
@RestController
@RequestMapping("/system/org")
@RequiredArgsConstructor
public class SysOrgController {
private final SysOrgService sysOrgService;
@Operation(summary = "组织树")
@GetMapping("/tree")
public Result<List<TreeNodeVO>> tree() {
return Result.success(sysOrgService.listOrgTree());
}
@Operation(summary = "组织及全部下级组织 ID(数据域「本部门及下级」使用)")
@GetMapping("/{orgId}/children")
public Result<List<Long>> children(@PathVariable Long orgId) {
return Result.success(sysOrgService.listSelfAndChildOrgIds(orgId));
}
}