提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.system.api.dept; |
H |
2 |
|
|
3 |
import cn.hutool.core.collection.CollUtil; |
|
4 |
import cn.hutool.core.map.MapUtil; |
|
5 |
import com.iailab.framework.common.pojo.CommonResult; |
|
6 |
import com.iailab.framework.common.util.collection.CollectionUtils; |
|
7 |
import com.iailab.module.system.api.dept.dto.PostRespDTO; |
|
8 |
import com.iailab.module.system.enums.ApiConstants; |
|
9 |
import io.swagger.v3.oas.annotations.Operation; |
|
10 |
import io.swagger.v3.oas.annotations.Parameter; |
|
11 |
import io.swagger.v3.oas.annotations.tags.Tag; |
|
12 |
import org.springframework.cloud.openfeign.FeignClient; |
|
13 |
import org.springframework.web.bind.annotation.GetMapping; |
|
14 |
import org.springframework.web.bind.annotation.RequestParam; |
|
15 |
|
|
16 |
import java.util.Collection; |
|
17 |
import java.util.List; |
|
18 |
import java.util.Map; |
|
19 |
|
1ecdfb
|
20 |
@FeignClient(name = ApiConstants.NAME) |
e7c126
|
21 |
@Tag(name = "RPC 服务 - 岗位") |
H |
22 |
public interface PostApi { |
|
23 |
|
|
24 |
String PREFIX = ApiConstants.PREFIX + "/post"; |
|
25 |
|
|
26 |
@GetMapping(PREFIX + "/valid") |
|
27 |
@Operation(summary = "校验岗位是否合法") |
|
28 |
@Parameter(name = "ids", description = "岗位编号数组", example = "1,2", required = true) |
|
29 |
CommonResult<Boolean> validPostList(@RequestParam("ids") Collection<Long> ids); |
|
30 |
|
|
31 |
@GetMapping(PREFIX + "/list") |
|
32 |
@Operation(summary = "获得岗位列表") |
|
33 |
@Parameter(name = "ids", description = "岗位编号数组", example = "1,2", required = true) |
|
34 |
CommonResult<List<PostRespDTO>> getPostList(@RequestParam("ids") Collection<Long> ids); |
|
35 |
|
|
36 |
default Map<Long, PostRespDTO> getPostMap(Collection<Long> ids) { |
|
37 |
if (CollUtil.isEmpty(ids)) { |
|
38 |
return MapUtil.empty(); |
|
39 |
} |
|
40 |
|
|
41 |
List<PostRespDTO> list = getPostList(ids).getData(); |
|
42 |
return CollectionUtils.convertMap(list, PostRespDTO::getId); |
|
43 |
} |
|
44 |
|
|
45 |
} |