Ejemplo n.º 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();
 }
Ejemplo n.º 2
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;
 }