Browse Source

放开menu部分权限

test
smallchill 6 years ago
parent
commit
c91d5624fd
  1. 51
      blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java

51
blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java

@ -85,11 +85,33 @@ public class MenuController extends BladeController {
return R.data(menuWrapper.listNodeVO(list));
}
/**
* 新增或修改
*/
@PostMapping("/submit")
@CacheEvict(cacheNames = {AUTH_ROUTES})
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperation(value = "新增或修改", notes = "传入menu", position = 8)
public R submit(@Valid @RequestBody Menu menu) {
return R.status(menuService.saveOrUpdate(menu));
}
/**
* 删除
*/
@PostMapping("/remove")
@CacheEvict(cacheNames = {AUTH_ROUTES})
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperation(value = "删除", notes = "传入ids", position = 9)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(menuService.removeByIds(Func.toIntList(ids)));
}
/**
* 前端菜单数据
*/
@GetMapping("/routes")
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperation(value = "前端菜单数据", notes = "前端菜单数据", position = 3)
public R<List<MenuVO>> routes(BladeUser user) {
List<MenuVO> list = menuService.routes(user.getRoleId());
@ -100,7 +122,6 @@ public class MenuController extends BladeController {
* 前端按钮数据
*/
@GetMapping("/buttons")
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperation(value = "前端按钮数据", notes = "前端按钮数据", position = 4)
public R<List<MenuVO>> buttons(BladeUser user) {
List<MenuVO> list = menuService.buttons(user.getRoleId());
@ -111,7 +132,6 @@ public class MenuController extends BladeController {
* 获取菜单树形结构
*/
@GetMapping("/tree")
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperation(value = "树形结构", notes = "树形结构", position = 5)
public R<List<MenuVO>> tree() {
List<MenuVO> tree = menuService.tree();
@ -122,7 +142,6 @@ public class MenuController extends BladeController {
* 获取权限分配树形结构
*/
@GetMapping("/grant-tree")
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperation(value = "权限分配树形结构", notes = "权限分配树形结构", position = 6)
public R<List<MenuVO>> grantTree(BladeUser user) {
return R.data(menuService.grantTree(user));
@ -132,35 +151,11 @@ public class MenuController extends BladeController {
* 获取权限分配树形结构
*/
@GetMapping("/role-tree-keys")
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperation(value = "角色所分配的树", notes = "角色所分配的树", position = 7)
public R<List<String>> roleTreeKeys(String roleIds) {
return R.data(menuService.roleTreeKeys(roleIds));
}
/**
* 新增或修改
*/
@PostMapping("/submit")
@CacheEvict(cacheNames = {AUTH_ROUTES})
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperation(value = "新增或修改", notes = "传入menu", position = 8)
public R submit(@Valid @RequestBody Menu menu) {
return R.status(menuService.saveOrUpdate(menu));
}
/**
* 删除
*/
@PostMapping("/remove")
@CacheEvict(cacheNames = {AUTH_ROUTES})
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperation(value = "删除", notes = "传入ids", position = 9)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(menuService.removeByIds(Func.toIntList(ids)));
}
/**
* 获取配置的角色权限
*/

Loading…
Cancel
Save