提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.system.api.dept; |
H |
2 |
|
|
3 |
import com.iailab.framework.common.pojo.CommonResult; |
|
4 |
import com.iailab.framework.common.util.collection.CollectionUtils; |
|
5 |
import com.iailab.module.system.api.dept.dto.DeptRespDTO; |
|
6 |
import com.iailab.module.system.enums.ApiConstants; |
|
7 |
import io.swagger.v3.oas.annotations.Operation; |
|
8 |
import io.swagger.v3.oas.annotations.Parameter; |
|
9 |
import io.swagger.v3.oas.annotations.tags.Tag; |
|
10 |
import org.springframework.cloud.openfeign.FeignClient; |
|
11 |
import org.springframework.web.bind.annotation.GetMapping; |
|
12 |
import org.springframework.web.bind.annotation.RequestParam; |
|
13 |
|
|
14 |
import java.util.Collection; |
|
15 |
import java.util.List; |
|
16 |
import java.util.Map; |
|
17 |
import java.util.Set; |
|
18 |
|
1ecdfb
|
19 |
@FeignClient(name = ApiConstants.NAME) |
e7c126
|
20 |
@Tag(name = "RPC 服务 - 部门") |
H |
21 |
public interface DeptApi { |
|
22 |
|
|
23 |
String PREFIX = ApiConstants.PREFIX + "/dept"; |
|
24 |
|
|
25 |
@GetMapping(PREFIX + "/get") |
|
26 |
@Operation(summary = "获得部门信息") |
|
27 |
@Parameter(name = "id", description = "部门编号", example = "1024", required = true) |
|
28 |
CommonResult<DeptRespDTO> getDept(@RequestParam("id") Long id); |
|
29 |
|
|
30 |
@GetMapping(PREFIX + "/list") |
|
31 |
@Operation(summary = "获得部门信息数组") |
|
32 |
@Parameter(name = "ids", description = "部门编号数组", example = "1,2", required = true) |
|
33 |
CommonResult<List<DeptRespDTO>> getDeptList(@RequestParam("ids") Collection<Long> ids); |
|
34 |
|
|
35 |
@GetMapping(PREFIX + "/valid") |
|
36 |
@Operation(summary = "校验部门是否合法") |
|
37 |
@Parameter(name = "ids", description = "部门编号数组", example = "1,2", required = true) |
|
38 |
CommonResult<Boolean> validateDeptList(@RequestParam("ids") Collection<Long> ids); |
|
39 |
|
|
40 |
/** |
|
41 |
* 获得指定编号的部门 Map |
|
42 |
* |
|
43 |
* @param ids 部门编号数组 |
|
44 |
* @return 部门 Map |
|
45 |
*/ |
|
46 |
default Map<Long, DeptRespDTO> getDeptMap(Collection<Long> ids) { |
|
47 |
List<DeptRespDTO> list = getDeptList(ids).getCheckedData(); |
|
48 |
return CollectionUtils.convertMap(list, DeptRespDTO::getId); |
|
49 |
} |
|
50 |
|
|
51 |
@GetMapping(PREFIX + "/list-child") |
|
52 |
@Operation(summary = "获得指定部门的所有子部门") |
|
53 |
@Parameter(name = "id", description = "部门编号", example = "1024", required = true) |
|
54 |
CommonResult<List<DeptRespDTO>> getChildDeptList(@RequestParam("id") Long id); |
|
55 |
|
|
56 |
} |