Example #1
0
 @RequiresPermissions("cms:article:view")
 @RequestMapping(value = "form")
 public String form(Article article, Model model) {
   // 如果当前传参有子节点,则选择取消传参选择
   if (article.getCategory() != null && StringUtils.isNotBlank(article.getCategory().getId())) {
     List<Category> list =
         categoryService.findByParentId(article.getCategory().getId(), Site.getCurrentSiteId());
     if (list.size() > 0) {
       article.setCategory(null);
     } else {
       article.setCategory(categoryService.get(article.getCategory().getId()));
     }
   }
   article.setArticleData(articleDataService.get(article.getId()));
   //		if (article.getCategory()=null && StringUtils.isNotBlank(article.getCategory().getId())){
   //			Category category = categoryService.get(article.getCategory().getId());
   //		}
   model.addAttribute("contentViewList", getTplContent());
   model.addAttribute("article_DEFAULT_TEMPLATE", Article.DEFAULT_TEMPLATE);
   model.addAttribute("article", article);
   CmsUtils.addViewConfigAttribute(model, article.getCategory());
   return "modules/cms/articleForm";
 }
Example #2
0
 /**
  * 获取栏目
  *
  * @param id 栏目编号
  * @return
  */
 public static Category getCategory(long categoryId) {
   return categoryService.get(categoryId);
 }