高級查詢,分頁
阿新 • • 發佈:2018-07-22
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);View Code7 //當前頁 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 }
2:封裝分頁對象:
3.封裝高級查詢對象:
高級查詢,分頁