本文整理汇总了Java中com.zheng.common.util.Paginator类的典型用法代码示例。如果您正苦于以下问题:Java Paginator类的具体用法?Java Paginator怎么用?Java Paginator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Paginator类属于com.zheng.common.util包,在下文中一共展示了Paginator类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: list
import com.zheng.common.util.Paginator; //导入依赖的package包/类
@RequestMapping(value = "/list", method = RequestMethod.GET)
public String list(
@RequestParam(required = false, defaultValue = "1", value = "page") int page,
HttpServletRequest request,
Model model) {
// 专题列表
int rows = 10;
CmsTopicExample cmsTopicExample = new CmsTopicExample();
List<CmsTopic> topics = cmsTopicService.selectByExampleForOffsetPage(cmsTopicExample, (page - 1) * rows, rows);
model.addAttribute("topics", topics);
// 文章总数
long total = cmsTopicService.countByExample(cmsTopicExample);
// 分页
Paginator paginator = new Paginator(total, page, rows, request);
model.addAttribute("paginator", paginator);
return thymeleaf("/topic/list");
}
示例2: index
import com.zheng.common.util.Paginator; //导入依赖的package包/类
@RequestMapping(value = "/{keyword}", method = RequestMethod.GET)
public String index(@PathVariable("keyword") String keyword,
@RequestParam(required = false, defaultValue = "1", value = "page") int page,
@RequestParam(required = false, defaultValue = "orders", value = "sort") String sort,
@RequestParam(required = false, defaultValue = "desc", value = "order") String order,
HttpServletRequest request,
Model model) {
// 该关键字文章列表
int rows = 10;
CmsArticleExample cmsArticleExample = new CmsArticleExample();
cmsArticleExample.createCriteria()
.andStatusEqualTo((byte) 1)
.andTitleLike(keyword);
if (!StringUtils.isBlank(sort) && !StringUtils.isBlank(order)) {
cmsArticleExample.setOrderByClause(sort + " " + order);
}
List<CmsArticle> articles = cmsArticleService.selectByExampleForOffsetPage(cmsArticleExample, (page - 1) * rows, rows);
model.addAttribute("articles", articles);
// 文章总数
long total = cmsArticleService.countByExample(cmsArticleExample);
// 分页
Paginator paginator = new Paginator(total, page, rows, request);
model.addAttribute("paginator", paginator);
return thymeleaf("/search/index");
}
示例3: index
import com.zheng.common.util.Paginator; //导入依赖的package包/类
/**
* 首页
* @param page
* @param sort
* @param order
* @param request
* @param model
* @return
*/
@RequestMapping(value = "", method = RequestMethod.GET)
public String index(@RequestParam(required = false, defaultValue = "1", value = "page") int page,
@RequestParam(required = false, defaultValue = "orders", value = "sort") String sort,
@RequestParam(required = false, defaultValue = "desc", value = "order") String order,
HttpServletRequest request,
Model model) {
// 系统id
CmsSystemExample cmsSystemExample = new CmsSystemExample();
cmsSystemExample.createCriteria()
.andCodeEqualTo(CODE);
CmsSystem system = cmsSystemService.selectFirstByExample(cmsSystemExample);
model.addAttribute("system", system);
// 该系统类目
CmsCategoryExample cmsCategoryExample = new CmsCategoryExample();
cmsCategoryExample.createCriteria()
.andSystemIdEqualTo(system.getSystemId());
cmsCategoryExample.setOrderByClause("orders asc");
List<CmsCategory> categories = cmsCategoryService.selectByExample(cmsCategoryExample);
model.addAttribute("categories", categories);
// 该系统标签
CmsTagExample cmsTagExample = new CmsTagExample();
cmsTagExample.createCriteria()
.andSystemIdEqualTo(system.getSystemId());
cmsTagExample.setOrderByClause("orders asc");
List<CmsTag> tags = cmsTagService.selectByExample(cmsTagExample);
model.addAttribute("tags", tags);
// 该系统文章列表
int rows = 10;
CmsArticleExample cmsArticleExample = new CmsArticleExample();
cmsArticleExample.createCriteria()
.andStatusEqualTo((byte) 1)
.andSystemIdEqualTo(system.getSystemId());
if (!StringUtils.isBlank(sort) && !StringUtils.isBlank(order)) {
cmsArticleExample.setOrderByClause(sort + " " + order);
}
List<CmsArticle> articles = cmsArticleService.selectByExampleForOffsetPage(cmsArticleExample, (page - 1) * rows, rows);
model.addAttribute("articles", articles);
// 文章总数
long total = cmsArticleService.countByExample(cmsArticleExample);
// 分页
Paginator paginator = new Paginator(total, page, rows, request);
model.addAttribute("paginator", paginator);
return thymeleaf("/qa/index");
}
示例4: index
import com.zheng.common.util.Paginator; //导入依赖的package包/类
/**
* 首页
* @param page
* @param sort
* @param order
* @param request
* @param model
* @return
*/
@RequestMapping(value = "", method = RequestMethod.GET)
public String index(@RequestParam(required = false, defaultValue = "1", value = "page") int page,
@RequestParam(required = false, defaultValue = "orders", value = "sort") String sort,
@RequestParam(required = false, defaultValue = "desc", value = "order") String order,
HttpServletRequest request,
Model model) {
// 系统id
CmsSystemExample cmsSystemExample = new CmsSystemExample();
cmsSystemExample.createCriteria()
.andCodeEqualTo(CODE);
CmsSystem system = cmsSystemService.selectFirstByExample(cmsSystemExample);
model.addAttribute("system", system);
// 该系统类目
CmsCategoryExample cmsCategoryExample = new CmsCategoryExample();
cmsCategoryExample.createCriteria()
.andSystemIdEqualTo(system.getSystemId());
cmsCategoryExample.setOrderByClause("orders asc");
List<CmsCategory> categories = cmsCategoryService.selectByExample(cmsCategoryExample);
model.addAttribute("categories", categories);
// 该系统标签
CmsTagExample cmsTagExample = new CmsTagExample();
cmsTagExample.createCriteria()
.andSystemIdEqualTo(system.getSystemId());
cmsTagExample.setOrderByClause("orders asc");
List<CmsTag> tags = cmsTagService.selectByExample(cmsTagExample);
model.addAttribute("tags", tags);
// 该系统文章列表
int rows = 10;
CmsArticleExample cmsArticleExample = new CmsArticleExample();
cmsArticleExample.createCriteria()
.andStatusEqualTo((byte) 1)
.andSystemIdEqualTo(system.getSystemId());
if (!StringUtils.isBlank(sort) && !StringUtils.isBlank(order)) {
cmsArticleExample.setOrderByClause(sort + " " + order);
}
List<CmsArticle> articles = cmsArticleService.selectByExampleForOffsetPage(cmsArticleExample, (page - 1) * rows, rows);
model.addAttribute("articles", articles);
// 文章总数
long total = cmsArticleService.countByExample(cmsArticleExample);
// 分页
Paginator paginator = new Paginator(total, page, rows, request);
model.addAttribute("paginator", paginator);
return thymeleaf("/news/index");
}
示例5: index
import com.zheng.common.util.Paginator; //导入依赖的package包/类
/**
* 首页
* @param page
* @param sort
* @param order
* @param request
* @param model
* @return
*/
@RequestMapping(value = "", method = RequestMethod.GET)
public String index(@RequestParam(required = false, defaultValue = "1", value = "page") int page,
@RequestParam(required = false, defaultValue = "orders", value = "sort") String sort,
@RequestParam(required = false, defaultValue = "desc", value = "order") String order,
HttpServletRequest request,
Model model) {
// 系统id
CmsSystemExample cmsSystemExample = new CmsSystemExample();
cmsSystemExample.createCriteria()
.andCodeEqualTo(CODE);
CmsSystem system = cmsSystemService.selectFirstByExample(cmsSystemExample);
model.addAttribute("system", system);
// 该系统类目
CmsCategoryExample cmsCategoryExample = new CmsCategoryExample();
cmsCategoryExample.createCriteria()
.andSystemIdEqualTo(system.getSystemId());
cmsCategoryExample.setOrderByClause("orders asc");
List<CmsCategory> categories = cmsCategoryService.selectByExample(cmsCategoryExample);
model.addAttribute("categories", categories);
// 该系统标签
CmsTagExample cmsTagExample = new CmsTagExample();
cmsTagExample.createCriteria()
.andSystemIdEqualTo(system.getSystemId());
cmsTagExample.setOrderByClause("orders asc");
List<CmsTag> tags = cmsTagService.selectByExample(cmsTagExample);
model.addAttribute("tags", tags);
// 该系统文章列表
int rows = 10;
CmsArticleExample cmsArticleExample = new CmsArticleExample();
cmsArticleExample.createCriteria()
.andStatusEqualTo((byte) 1)
.andSystemIdEqualTo(system.getSystemId());
if (!StringUtils.isBlank(sort) && !StringUtils.isBlank(order)) {
cmsArticleExample.setOrderByClause(sort + " " + order);
}
List<CmsArticle> articles = cmsArticleService.selectByExampleForOffsetPage(cmsArticleExample, (page - 1) * rows, rows);
model.addAttribute("articles", articles);
// 文章总数
long total = cmsArticleService.countByExample(cmsArticleExample);
// 分页
Paginator paginator = new Paginator(total, page, rows, request);
model.addAttribute("paginator", paginator);
return thymeleaf("/blog/index");
}