コード例 #1
0
 @RequiresPermissions("cms:category:view")
 @RequestMapping(value = "form")
 public String form(Category category, Model model) {
   if (category.getParent() == null || category.getParent().getId() == null) {
     category.setParent(new Category("1"));
   }
   Category parent = categoryService.get(category.getParent().getId());
   category.setParent(parent);
   if (category.getOffice() == null || category.getOffice().getId() == null) {
     category.setOffice(parent.getOffice());
   }
   model.addAttribute("listViewList", getTplContent(Category.DEFAULT_TEMPLATE));
   model.addAttribute("category_DEFAULT_TEMPLATE", Category.DEFAULT_TEMPLATE);
   model.addAttribute("contentViewList", getTplContent(Article.DEFAULT_TEMPLATE));
   model.addAttribute("article_DEFAULT_TEMPLATE", Article.DEFAULT_TEMPLATE);
   model.addAttribute("office", category.getOffice());
   model.addAttribute("category", category);
   return "modules/cms/categoryForm";
 }