151152153154155156157158159
} public List<Post> queryPublishLatestPost(int count) { String condition = PUBLISH_POST; String order = "id desc"; PageInfo page = new PageInfo(1, count); return query(condition, order, page, false); }
159160161162163164165166167168169
} public List<Post> queryPublishRelativePost(Post post, int count) { String condition = PUBLISH_POST; String order = "rand()"; PageInfo page = new PageInfo(1, count); StringBuilder tagids = new StringBuilder("("); int i = 0; for (Tag tag : post.getTags()) { if (i > 0)
4546474849505152535455
} // 先设置分页(缓存可能需要) if (needPage()) { int page = getIntParam("page", 1); pageInfo = new PageInfo(page, Config.pageSize); } // 读取缓存 Object cache = Cache.get(cacheKey()); if (cache != null) {
9293949596979899100101102
// 所有页面 context.getRoot().put( "pages", postService.queryPublishPageByKeywords(null, new PageInfo(1, 10))); // 最新文章 context.getRoot().put("latestPosts", postService.queryPublishLatestPost(10));