“谢茂盛”
authored
|
1
2
|
package com.order.erp.controller;
|
“谢茂盛”
authored
|
3
|
import com.order.erp.common.annotation.AnonymousAccess;
|
“谢茂盛”
authored
|
4
|
import com.order.erp.common.constant.ServerResult;
|
“谢茂盛”
authored
|
5
|
import com.order.erp.domain.vo.admin.AdminAuthRoleVO;
|
“谢茂盛”
authored
|
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
|
import com.order.erp.domain.vo.admin.AdminRoleQueryVO;
import com.order.erp.domain.vo.admin.AdminRoleVO;
import com.order.erp.log.Log;
import com.order.erp.service.admin.AdminRoleService;
import com.order.erp.service.admin.AdminUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
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 javax.annotation.Resource;
/**
* @date 2018-12-03
*/
@Api(tags = "系统:角色管理")
@RestController
@RequestMapping("/order/erp/roles")
public class RoleController {
@Resource
private AdminRoleService roleService;
@Resource
private AdminUserService userService;
private static final String ENTITY_NAME = "role";
@ApiOperation("获取单个role")
@PostMapping(value = "/detail")
|
“谢茂盛”
authored
|
41
|
@AnonymousAccess
|
“谢茂盛”
authored
|
42
43
44
45
46
47
|
public ServerResult detail(@RequestBody @Validated AdminRoleQueryVO queryVO) {
return ServerResult.success(roleService.getById(queryVO.getId()));
}
@ApiOperation("返回全部的角色")
@PostMapping(value = "/all")
|
“谢茂盛”
authored
|
48
|
@AnonymousAccess
|
“谢茂盛”
authored
|
49
50
51
52
53
54
55
|
public ServerResult getAll(@RequestBody @Validated AdminRoleQueryVO queryVO) {
return roleService.listByLevel(queryVO.getLevel());
}
@Log("查询角色")
@ApiOperation("查询角色")
@PostMapping(value = "/list_by_page")
|
“谢茂盛”
authored
|
56
|
@AnonymousAccess
|
“谢茂盛”
authored
|
57
58
59
60
61
62
63
|
public ServerResult listByPage(@RequestBody @Validated AdminRoleQueryVO queryVO) {
return roleService.listByPage(queryVO);
}
@Log("新增角色")
@ApiOperation("新增角色")
@PostMapping(value = "/add")
|
“谢茂盛”
authored
|
64
|
@AnonymousAccess
|
“谢茂盛”
authored
|
65
|
public ServerResult add(@RequestBody @Validated AdminRoleVO roleVO) {
|
“谢茂盛”
authored
|
66
|
return roleService.add(roleVO);
|
“谢茂盛”
authored
|
67
68
69
70
71
|
}
@Log("修改角色")
@ApiOperation("修改角色")
@PostMapping(value = "/edit")
|
“谢茂盛”
authored
|
72
|
@AnonymousAccess
|
“谢茂盛”
authored
|
73
|
public ServerResult edit(@RequestBody @Validated AdminRoleVO roleVO) {
|
“谢茂盛”
authored
|
74
|
return roleService.edit(roleVO);
|
“谢茂盛”
authored
|
75
76
|
}
|
“谢茂盛”
authored
|
77
78
79
|
@Log("授权角色菜单")
@ApiOperation("授权角色菜单")
@PostMapping(value = "/auth_menu")
|
“谢茂盛”
authored
|
80
|
@AnonymousAccess
|
“谢茂盛”
authored
|
81
82
|
public ServerResult authMenu(@RequestBody @Validated AdminAuthRoleVO roleVO) {
return roleService.authMenu(roleVO);
|
“谢茂盛”
authored
|
83
84
85
86
87
|
}
@Log("删除角色")
@ApiOperation("删除角色")
@PostMapping(value = "/delete")
|
“谢茂盛”
authored
|
88
|
@AnonymousAccess
|
“谢茂盛”
authored
|
89
|
public ServerResult delete(@RequestBody @Validated AdminRoleQueryVO queryVO) {
|
“谢茂盛”
authored
|
90
|
return roleService.deleteById(queryVO);
|
“谢茂盛”
authored
|
91
92
|
}
}
|