示例#1
0
 @Override
 public Page findBillsByPageAndMohu(int currentPage, int pageSize, String... keyWords)
     throws Exception {
   Page page = new Page();
   int count = this.getCount(keyWords);
   int totalPage = count % pageSize == 0 ? count / pageSize : ((count / pageSize) + 1);
   int previousPage = 0;
   if (currentPage == 1) {
     previousPage = 1;
   } else {
     previousPage = currentPage - 1;
   }
   int nextPage = 0;
   if (currentPage == totalPage) {
     nextPage = totalPage;
   } else {
     nextPage = currentPage + 1;
   }
   page.setCurrentPage(currentPage);
   page.setCurrentPageData(this.findBillsByPageAndMohuImpl(currentPage, pageSize, keyWords));
   page.setNextPage(nextPage);
   page.setPageSize(pageSize);
   page.setPreviousPage(previousPage);
   page.setTotalCount(count);
   page.setTotalPage(totalPage);
   return page;
 }
示例#2
0
 @Override
 public Page findBillsByPage(int currentPage, int pageSize) throws Exception {
   Page page = new Page();
   int count = this.getCount();
   // 如何总count数可以被pageSize整除,则取这个数,否则取这个数加一
   int totalPage = count % pageSize == 0 ? count / pageSize : ((count / pageSize) + 1);
   int previousPage = 0;
   if (currentPage == 1) {
     previousPage = 1;
   } else {
     previousPage = currentPage - 1;
   }
   int nextPage = 0;
   if (currentPage == totalPage) {
     nextPage = totalPage;
   } else {
     nextPage = currentPage + 1;
   }
   page.setCurrentPage(currentPage);
   page.setCurrentPageData(this.findBillsByPageImpl(currentPage, pageSize));
   page.setNextPage(nextPage);
   page.setPageSize(pageSize);
   page.setPreviousPage(previousPage);
   page.setTotalCount(count);
   page.setTotalPage(totalPage);
   return page;
 }