1. 程式人生 > >高級查詢,分頁

高級查詢,分頁

mit 當前 urn one com .get .com 高級查詢 rri

高級查詢,分頁:

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.封裝高級查詢對象:

技術分享圖片

技術分享圖片

高級查詢,分頁