diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java b/blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java index cadfe1b2..c9d7c5b7 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java +++ b/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> routes(BladeUser user) { List 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> buttons(BladeUser user) { List 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> tree() { List 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> 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> 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))); - } - /** * 获取配置的角色权限 */