/** * 对结果list进行分页的方法 * @param list * @param pageNum * @param pageSize * @return */ public static IPage listToPage(List list, int pageNum, int pageSize){ List pageList = new ArrayList<>(); int curIdx = pageNum > 1 ? (pageNum - 1) * pageSize : 0; for (int i = 0; i < pageSize && curIdx + i < list.size(); i++) { pageList.add(list.get(curIdx + i)); } IPage page = new Page<>(pageNum, pageSize); page.setRecords(pageList); page.setTotal(list.size()); return page; }
@Override public IPage<AllGamePlatformByMonth> getList(Page startPage, AllGamePlatformByMonth allGamePlatformByMonth) { List<AllGamePlatformByMonth> resultList = allGamePlatformByMonthService.getAllGamePlatformByMonthList(allGamePlatformByMonth); IPage <AllGamePlatformByMonth> iPage = listToPage(resultList, (int) startPage.getCurrent(), (int) startPage.getSize()); return iPage; }