IPage的实现类Page的属性:
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;
}