Exemplo n.º 1
0
 /* 有图片类文章列表 */
 @RequestMapping("/lists/{categoryId}")
 public String lists(@PathVariable Integer categoryId, ModelMap model, PageInfo pageInfo) {
   pageInfo.setPageSize(30);
   model.addAttribute(
       "pagedContent", articleService.getPagedContentByCategoryIdService(categoryId, pageInfo));
   model.addAttribute("pageUrl", "testurl");
   return "/client/article/lists";
 }
Exemplo n.º 2
0
 /**
  * 添加多栏目文章ftl模板属性 - 多个栏目文章在前台显示前Num条时,用此方法可以一次性添加ftl模板使用的属性
  *
  * @param entity 文章实体前缀 ftl模板中生成形如 entity_categoryId 实体List
  * @param more 更多文章前缀 ftl模板中生成形如 more_categoryId int值
  * @param categoryIdAndNums 文章栏目Id和其前Num条 组成的二维数组
  * @param model
  * @return 多栏目文章ftl模板属性
  */
 private void addAttributes(
     String entity, String more, Integer[][] categoryIdAndNums, ModelMap model) {
   for (Integer[] group : categoryIdAndNums) {
     model.addAttribute(
         entity + "_" + String.valueOf(group[0]),
         articleService.getNumListService(group[0], Integer.valueOf(group[1].toString())));
     model.addAttribute(more + "_" + String.valueOf(group[0]), group[0]);
   }
 }
Exemplo n.º 3
0
  /* 首页 */
  @RequestMapping("/")
  public String index(ModelMap model) {
    Integer[][] groups =
        new Integer[][] {{17, 3}, {5, 8}, {7, 7}, {6, 6}, {4, 6}, {1, 8}, {2, 8}, {3, 8}};
    addAttributes("article", "more", groups, model);

    model.addAttribute(
        "articles",
        articleService.getService(
            0,
            4,
            "id",
            "desc",
            new Object[] {"articleCategoryId", "=", 4},
            new Object[] {"title", "like", "%大学%"}));
    return "/client/index";
  }
Exemplo n.º 4
0
 /* 多篇类文章 - 单篇展示 */
 @RequestMapping("/articles/{id}")
 public String articles(@PathVariable Integer id, ModelMap model) {
   model.addAttribute("article", articleService.getService(id));
   return "/client/article/articles";
 }