Example #1
0
 /**
  * 获得栏目列表
  *
  * @param siteId 站点编号
  * @param parentId 分类父编号
  * @param number 获取数目
  * @param param 预留参数,例: key1:'value1', key2:'value2' ...
  */
 public static List<Category> getCategoryList(
     long siteId, long parentId, int number, String param) {
   Page<Category> page = new Page<Category>(1, number, -1);
   Category category = new Category();
   category.setSite(new Site(siteId));
   category.setParent(new Category(parentId));
   if (StringUtils.isNotBlank(param)) {
     @SuppressWarnings({"unused", "rawtypes"})
     Map map = JsonMapper.getInstance().fromJson("{" + param + "}", Map.class);
   }
   page = categoryService.find(page, category);
   return page.getList();
 }
Example #2
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 #3
0
 /**
  * 获得主导航列表
  *
  * @param siteId 站点编号
  */
 public static List<Category> getMainNavList(long siteId) {
   @SuppressWarnings("unchecked")
   List<Category> mainNavList =
       (List<Category>) CacheUtils.get(CMS_CACHE, "mainNavList_" + siteId);
   if (mainNavList == null) {
     Category category = new Category();
     category.setSite(new Site(siteId));
     category.setParent(new Category(1L));
     category.setInMenu(Category.SHOW);
     Page<Category> page = new Page<Category>(1, -1);
     page = categoryService.find(page, category);
     mainNavList = page.getList();
     CacheUtils.put(CMS_CACHE, "mainNavList_" + siteId, mainNavList);
   }
   return mainNavList;
 }
Example #4
0
 /**
  * 获取栏目
  *
  * @param ids 栏目编号
  * @return
  */
 public static List<Category> getCategoryListByIds(String categoryIds) {
   return categoryService.findByIds(categoryIds);
 }
Example #5
0
 /**
  * 获取栏目
  *
  * @param id 栏目编号
  * @return
  */
 public static Category getCategory(long categoryId) {
   return categoryService.get(categoryId);
 }