RoleDictController.java
3.33 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
package com.meishu.controller;
import com.meishu.common.ResponseData;
import com.meishu.common.ResponseVO;
import com.meishu.common.interceptor.LoginRequired;
import com.meishu.dto.role.AddPermissionDTO;
import com.meishu.dto.role.DeletePermissionDTO;
import com.meishu.dto.role.GetRoleTeachersDTO;
import com.meishu.dto.role.RoleTeacherDTO;
import com.meishu.mapper.RoleAdministerMappingMapper;
import com.meishu.model.RoleAdministerMappingDO;
import com.meishu.service.RoleDictService;
import com.meishu.util.ConstantUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 角色表 前端控制器
* </p>
*
* @author Tuyp
* @since 2021-04-26
*/
@RestController
@Api(tags = "角色字典表")
@RequestMapping("/roleDict")
public class RoleDictController {
@Autowired
private RoleDictService roleDictService;
@PostMapping("getAllRoles")
@ApiOperation("获取所有的角色")
// @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getAllRoles(){
return ResponseData.generateCreatedResponse(0,roleDictService.getAllRoles());
}
@PostMapping("getRoleTeachers")
@ApiOperation("获取某一角色下的所有老师 {roleId :角色id userName:老师名字 pageSize pageNum}")
// @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getRoleTeachers(@RequestBody GetRoleTeachersDTO getRoleTeachersDTO){
return ResponseData.generateCreatedResponse(0,roleDictService.getRoleTeachers(getRoleTeachersDTO));
}
@PostMapping("removeTeacher")
@ApiOperation("移除某一角色下的老师 ids {映射id} roleId :角色id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO removeTeacher(@RequestBody RoleTeacherDTO roleTeacherDTO){
return ResponseData.generateCreatedResponse(0,roleDictService.removeTeacher(roleTeacherDTO));
}
@PostMapping("roleTeacher")
@ApiOperation("添加老师的角色 ids:老师id[] roleId :角色id ")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO roleTeacher(@RequestBody RoleTeacherDTO roleTeacherDTO){
return ResponseData.generateCreatedResponse(0,roleDictService.roleTeacher(roleTeacherDTO));
}
@PostMapping("addPermission")
@ApiOperation("给角色添加权限 {roleId 角色id permissionIds 多个权限}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addPermission(@RequestBody AddPermissionDTO addPermissionDTO){
return ResponseData.generateCreatedResponse(0,roleDictService.addPermission(addPermissionDTO));
}
@PostMapping("deletePermission")
@ApiOperation("给角色删除权限 {roleId 角色id permissionIds 多个权限ids}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deletePermission(@RequestBody DeletePermissionDTO deletePermissionDTO){
return ResponseData.generateCreatedResponse(0,roleDictService.deletePermission(deletePermissionDTO));
}
}