houzhongjian
2024-10-16 7da8f196dee8e3c526c009a4bc7f5983ece6bb97
提交 | 用户 | 时间
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.service.permission.PermissionService;
6 import org.springframework.validation.annotation.Validated;
7 import org.springframework.web.bind.annotation.RestController;
8
9 import javax.annotation.Resource;
10 import java.util.Collection;
11 import java.util.Set;
12
13 import static com.iailab.framework.common.pojo.CommonResult.success;
14
15 @RestController // 提供 RESTful API 接口,给 Feign 调用
16 @Validated
17 public class PermissionApiImpl implements PermissionApi {
18
19     @Resource
20     private PermissionService permissionService;
21
22     @Override
23     public CommonResult<Set<Long>> getUserRoleIdListByRoleIds(Collection<Long> roleIds) {
24         return success(permissionService.getUserRoleIdListByRoleId(roleIds));
25     }
26
27     @Override
28     public CommonResult<Boolean> hasAnyPermissions(Long userId, String... permissions) {
29         return success(permissionService.hasAnyPermissions(userId, permissions));
30     }
31
32     @Override
33     public CommonResult<Boolean> hasAnyRoles(Long userId, String... roles) {
34         return success(permissionService.hasAnyRoles(userId, roles));
35     }
36
37     @Override
38     public CommonResult<DeptDataPermissionRespDTO> getDeptDataPermission(Long userId) {
39         return success(permissionService.getDeptDataPermission(userId));
40     }
41
42 }