@RequiresPermissions("sys:menu:edit") @RequestMapping(value = "delete") public String delete(Menu menu, RedirectAttributes redirectAttributes) { if (Global.isDemoMode()) { addMessage(redirectAttributes, "演示模式,不允许操作!"); return "redirect:" + adminPath + "/sys/menu/"; } // if (Menu.isRoot(id)){ // addMessage(redirectAttributes, "删除菜单失败, 不允许删除顶级菜单或编号为空"); // }else{ systemService.deleteMenu(menu); addMessage(redirectAttributes, "删除菜单成功"); // } return "redirect:" + adminPath + "/sys/menu/"; }
/** 批量修改菜单排序 */ @RequiresPermissions("sys:menu:edit") @RequestMapping(value = "updateSort") public String updateSort(String[] ids, Integer[] sorts, RedirectAttributes redirectAttributes) { if (Global.isDemoMode()) { addMessage(redirectAttributes, "演示模式,不允许操作!"); return "redirect:" + adminPath + "/sys/menu/"; } for (int i = 0; i < ids.length; i++) { Menu menu = new Menu(ids[i]); menu.setSort(sorts[i]); systemService.updateMenuSort(menu); } addMessage(redirectAttributes, "保存菜单排序成功!"); return "redirect:" + adminPath + "/sys/menu/"; }
@RequiresPermissions("sys:menu:edit") @RequestMapping(value = "save") public String save(Menu menu, Model model, RedirectAttributes redirectAttributes) { if (!UserUtils.getUser().isAdmin()) { addMessage(redirectAttributes, "越权操作,只有超级管理员才能添加或修改数据!"); return "redirect:" + adminPath + "/sys/role/?repage"; } if (Global.isDemoMode()) { addMessage(redirectAttributes, "演示模式,不允许操作!"); return "redirect:" + adminPath + "/sys/menu/"; } if (!beanValidator(model, menu)) { return form(menu, model); } systemService.saveMenu(menu); addMessage(redirectAttributes, "保存菜单'" + menu.getName() + "'成功"); return "redirect:" + adminPath + "/sys/menu/"; }