@RequiresPermissions("cms:category:edit") @RequestMapping(value = "save") public String save(Category category, Model model, RedirectAttributes redirectAttributes) { if (Global.isDemoMode()) { addMessage(redirectAttributes, "演示模式,不允许操作!"); return "redirect:" + adminPath + "/cms/category/"; } if (!beanValidator(model, category)) { return form(category, model); } categoryService.save(category); addMessage(redirectAttributes, "保存栏目'" + category.getName() + "'成功"); return "redirect:" + adminPath + "/cms/category/"; }
@RequiresPermissions("cms:category:edit") @RequestMapping(value = "delete") public String delete( Category category, HttpServletRequest request, RedirectAttributes redirectAttributes) { if (Global.isDemoMode()) { addMessage(redirectAttributes, "演示模式,不允许操作!"); return "redirect:" + adminPath + "/cms/category/"; } if (Category.isRoot(category.getId())) { addMessage(redirectAttributes, "删除栏目失败, 不允许删除顶级栏目或编号为空"); } else { categoryService.delete(category); addMessage(redirectAttributes, "删除栏目成功"); } String no = request.getParameter("pageNum"); return "redirect:" + adminPath + "/cms/category/" + "?pageNum=" + no; }