码迷,mamicode.com
首页 > 其他好文 > 详细

高级查询,分页

时间:2018-07-22 11:28:00      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:closed   http   com   query   spl   alt   class   get   set   

高级查询,分页:

1:service层:

技术分享图片

代码:

技术分享图片
 1   @Override
 2     public QueryLimitPageObj queryLimitPage(ProductQueryObj productQueryObj) {
 3         QueryLimitPageObj queryLimitPageObj = new QueryLimitPageObj();
 4       //查询列表
 5         List<Product> products = productDao.chooseQuery(productQueryObj);
 6         queryLimitPageObj.setData(products);
 7         //当前页
 8         Integer currentPage = productQueryObj.getCurrentPage();
 9         queryLimitPageObj.setCurrentPage(currentPage);
10         //每页显示条数
11         Integer pageSize = productQueryObj.getPageSize();
12         queryLimitPageObj.setPageSize(pageSize);
13         //总条数
14         int totalNum = productDao.getTotalNum(productQueryObj);
15         queryLimitPageObj.setTotalNum(totalNum);
16         //总页数
17          queryLimitPageObj.setTotalPage((totalNum + pageSize - 1)/ pageSize);
18         return queryLimitPageObj;
19     }
View Code

2:封装分页对象:

技术分享图片

3.封装高级查询对象:

技术分享图片

技术分享图片

 

高级查询,分页

标签:closed   http   com   query   spl   alt   class   get   set   

原文地址:https://www.cnblogs.com/dw3306/p/9349129.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!