提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.system.api.permission; |
H |
2 |
|
|
3 |
import com.iailab.framework.common.pojo.CommonResult; |
|
4 |
import com.iailab.module.system.api.permission.dto.DeptDataPermissionRespDTO; |
|
5 |
import com.iailab.module.system.enums.ApiConstants; |
|
6 |
import io.swagger.v3.oas.annotations.tags.Tag; |
|
7 |
import io.swagger.v3.oas.annotations.Parameter; |
|
8 |
import io.swagger.v3.oas.annotations.Parameters; |
|
9 |
import io.swagger.v3.oas.annotations.Operation; |
|
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.Set; |
|
16 |
|
1ecdfb
|
17 |
@FeignClient(name = ApiConstants.NAME) |
e7c126
|
18 |
@Tag(name = "RPC 服务 - 权限") |
H |
19 |
public interface PermissionApi { |
|
20 |
|
|
21 |
String PREFIX = ApiConstants.PREFIX + "/permission"; |
|
22 |
|
|
23 |
@GetMapping(PREFIX + "/user-role-id-list-by-role-id") |
|
24 |
@Operation(summary = "获得拥有多个角色的用户编号集合") |
|
25 |
@Parameter(name = "roleIds", description = "角色编号集合", example = "1,2", required = true) |
|
26 |
CommonResult<Set<Long>> getUserRoleIdListByRoleIds(@RequestParam("roleIds") Collection<Long> roleIds); |
|
27 |
|
|
28 |
@GetMapping(PREFIX + "/has-any-permissions") |
|
29 |
@Operation(summary = "判断是否有权限,任一一个即可") |
|
30 |
@Parameters({ |
|
31 |
@Parameter(name = "userId", description = "用户编号", example = "1", required = true), |
|
32 |
@Parameter(name = "permissions", description = "权限", example = "read,write", required = true) |
|
33 |
}) |
|
34 |
CommonResult<Boolean> hasAnyPermissions(@RequestParam("userId") Long userId, |
|
35 |
@RequestParam("permissions") String... permissions); |
|
36 |
|
|
37 |
@GetMapping(PREFIX + "/has-any-roles") |
|
38 |
@Operation(summary = "判断是否有角色,任一一个即可") |
|
39 |
@Parameters({ |
|
40 |
@Parameter(name = "userId", description = "用户编号", example = "1", required = true), |
|
41 |
@Parameter(name = "roles", description = "角色数组", example = "2", required = true) |
|
42 |
}) |
|
43 |
CommonResult<Boolean> hasAnyRoles(@RequestParam("userId") Long userId, |
|
44 |
@RequestParam("roles") String... roles); |
|
45 |
|
|
46 |
@GetMapping(PREFIX + "/get-dept-data-permission") |
|
47 |
@Operation(summary = "获得登陆用户的部门数据权限") |
|
48 |
@Parameter(name = "userId", description = "用户编号", example = "2", required = true) |
|
49 |
CommonResult<DeptDataPermissionRespDTO> getDeptDataPermission(@RequestParam("userId") Long userId); |
|
50 |
|
|
51 |
} |