@Test public void findCategoryByPage() { Page<Category> page = categoryService.findCategoryByPage(5-1, 20); System.out.println("总页数"+page.getTotalPages()); System.out.println("总记录数目"+page.getTotalElements()); System.out.println("当前页面"+(page.getNumber()+1)); System.out.println("当前页面的内容"+page.getContent()); System.out.println("当前页面的记录数目"+page.getNumberOfElements()); }
@Override public Page<Category> findCategoryByPage(Integer starPage, Integer itemNumber) { PageRequest pageRequest = new PageRequest(starPage,itemNumber); return categoryRepository.findAll(pageRequest); }
CategoryServiceImpl implements CategoryService { @Override public Page<Category> findCategoryByPage(Integer starPage, Integer itemNumber) { PageRequest pageRequest = new PageRequest(starPage,itemNumber); return categoryRepository.findAll(pageRequest); } }
CategoryServiceImpl implements CategoryService { @Override public Page<Category> findCategoryByPage(Integer starPage, Integer itemNumber) { PageRequest pageRequest = new PageRequest(starPage,itemNumber); return categoryRepository.findAll(pageRequest); }  }
CategoryServiceImpl implements CategoryService { @Override public Page<Category> findCategoryByPage(Integer starPage, Integer itemNumber) { PageRequest pageRequest = new PageRequest(starPage,itemNumber); return categoryRepository.findAll(pageRequest); }  @Override void saveCategory(Category category); @Override void insertCategories(Iterable<Category> iterable); @Override void deleteCategoryById(Long id); @Override void updateCategory(Category category); @Override Iterable<Category> findAll(); @Override Category findCategoryById(Long id); @Override Page<Category> findCategoryByPage(Integer starPage, Integer itemNumber); @Override Page<Category> findCategoryByPageAndOrder(Integer starPage, Integer itemNumber); }
CategoryServiceImpl implements CategoryService { @Override public Page<Category> findCategoryByPage(Integer starPage, Integer itemNumber) { PageRequest pageRequest = new PageRequest(starPage,itemNumber); return categoryRepository.findAll(pageRequest); }  @Override void saveCategory(Category category); @Override void insertCategories(Iterable<Category> iterable); @Override void deleteCategoryById(Long id); @Override void updateCategory(Category category); @Override Iterable<Category> findAll(); @Override Category findCategoryById(Long id); @Override Page<Category> findCategoryByPage(Integer starPage, Integer itemNumber); @Override Page<Category> findCategoryByPageAndOrder(Integer starPage, Integer itemNumber);  }