List手动分页方法
public static List<?> tablePage(List<?> list, Integer pageBegin, Integer pageSize) {
List<Object> result = new ArrayList<>();
if (list != null && list.size() > 0) {
int allCount = list.size();
int pageCount = (allCount + pageSize - 1) / pageSize;
if (pageBegin >= pageCount) {
pageBegin = pageCount;
}
int start = (pageBegin - 1) * pageSize;
int end = pageBegin * pageSize;
if (end >= allCount) {
end = allCount;
}
for (int i = start; i < end; i++) {
result.add(list.get(i));
}
}
return (result != null && result.size() > 0) ? result : null;
}