IRole.java
4.57 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package com.dituhui.pea.user;
import com.dituhui.pea.common.PageResult;
import com.dituhui.pea.common.Result;
import com.dituhui.pea.pojo.PageRequest;
import com.dituhui.pea.pojo.ResourceInfo;
import com.dituhui.pea.pojo.RoleInfo;
import com.dituhui.pea.pojo.WebResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* 角色相关接口
*/
@FeignClient(value = "project-user", contextId = "role")
public interface IRole {
/**
* 添加角色
*
* @param roleInfo 角色信息
* @return
*/
@RequestMapping(value = "/pea-user/role/add", method = RequestMethod.POST)
Result<RoleInfo> addRole(@RequestBody RoleInfo roleInfo);
/**
* 添加角色
*
* @param roleInfo 角色信息
* @return
*/
@RequestMapping(value = "/pea-user/role/delete2", method = RequestMethod.POST)
Result<RoleInfo> deleteRole2(@RequestBody RoleInfo roleInfo);
/**
* 修改角色
*
* @param roleInfo 角色信息
* @return
*/
@RequestMapping(value = "/pea-user/role/update", method = RequestMethod.POST)
Result<RoleInfo> updateRole(@RequestBody RoleInfo roleInfo);
/**
* 删除角色
*
* @param roleId 角色ID
* @return
*/
@RequestMapping(value = "/pea-user/role/delete", method = RequestMethod.POST)
Result<Boolean> deleteRole(@RequestBody RoleInfo roleInfo);
/**
* 添加用户角色
*
* @param roleId 角色ID
* @param userId 用户ID
* @return
*/
@RequestMapping(value = "/pea-user/role/addUser", method = RequestMethod.POST)
WebResult<Boolean> addUserRole(@RequestParam("id") String roleId, @RequestParam("userId") String userId);
/**
* 删除用户角色
*
* @param userId 用户ID
* @param roleId 角色ID
* @return
*/
@RequestMapping(value = "/pea-user/role/deleteUser", method = RequestMethod.POST)
WebResult<Boolean> deleteUserRole(@RequestParam("id") String roleId, @RequestParam("userId") String userId);
/**
* 添加资源
*
* @param resourceInfo 资源信息
* @return
*/
@RequestMapping(value = "/pea-user/resource/add", method = RequestMethod.POST)
WebResult<ResourceInfo> addResource(@RequestBody ResourceInfo resourceInfo);
/**
* 删除资源
*
* @param resourceId 资源ID
* @return
*/
@RequestMapping(value = "/pea-user/resource/delete", method = RequestMethod.POST)
WebResult<Boolean> deleteResource(@RequestParam("id") String resourceId);
/**
* 添加角色资源
*
* @param roleId 角色ID
* @param resourceId 资源ID
* @return
*/
@RequestMapping(value = "/pea-user/role/addResource", method = RequestMethod.POST)
WebResult<Boolean> addRoleResource(@RequestParam("id") String roleId, @RequestParam("resource_id") String resourceId);
/**
* 批量更新/替换角色权限/资源,会清空原来的权限/资源
*
* @param roleId 角色Id
* @param resourceIds 资源ID集合
* @return
*/
@RequestMapping(value = "/pea-user/role/replaceResources", method = RequestMethod.POST)
WebResult<Boolean> replaceRoleResource(@RequestParam("id") String roleId, @RequestParam("resource_ids") String resourceIds);
/**
* 删除角色资源
*
* @param roleId 角色ID
* @param resourceId 资源ID
* @return
*/
@RequestMapping(value = "/pea-user/role/deleteResource", method = RequestMethod.POST)
WebResult<Boolean> deleteRoleResource(@RequestParam("id") String roleId, @RequestParam("resource_id") String resourceId);
/**
* 获取角色列表
*
* @param pageRequest 分页参数
* @return
*/
@RequestMapping(value = "/pea-user/role/list", method = RequestMethod.GET)
Result<PageResult<RoleInfo>> listRole(PageRequest pageRequest);
/**
* 获取用户角色权限列表
*
* @param roleId 用户id
* @return
*/
@RequestMapping(value = "/pea-user/role/info", method = RequestMethod.GET)
Result<RoleInfo> info(@RequestParam("roleId") String roleId);
/**
* 获取用户角色权限列表
*
* @param userId 用户id
* @return
*/
@RequestMapping(value = "/pea-user/role/allResource", method = RequestMethod.GET)
Result<List<ResourceInfo>> allResource();
}