当前位置:网站首页>Manually page the list (parameter list, current page, page size)
Manually page the list (parameter list, current page, page size)
2022-07-04 06:05:00 【Hello song Xianshen】
/**
* For the result list The method of paging
* @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;
}
边栏推荐
- 注释与注解
- 如何判断数组中是否含有某个元素
- How does apscheduler set tasks not to be concurrent (that is, execute the next task after the first one)?
- Halcon image calibration enables subsequent image processing to become the same as the template image
- Compound nonlinear feedback control (2)
- Nexus 6p从8.0降级6.0+root
- Understanding of cross domain and how to solve cross domain problems
- Vant --- detailed explanation and use of list component in vant
- Input displays the currently selected picture
- Use of hutool Pinyin tool
猜你喜欢

724. Find the central subscript of the array

Accidentally deleted the data file of Clickhouse, can it be restored?

509. Fibonacci number, all paths of climbing stairs, minimum cost of climbing stairs

JS execution mechanism

Arc135 C (the proof is not very clear)

A little understanding of GSLB (global server load balance) technology

input显示当前选择的图片

How to realize multi account login of video platform members

LayoutManager布局管理器:FlowLayout、BorderLayout、GridLayout、GridBagLayout、CardLayout、BoxLayout

卸载Google Drive 硬盘-必须退出程序才能卸载
随机推荐
509. Fibonacci number, all paths of climbing stairs, minimum cost of climbing stairs
After the festival, a large number of people change careers. Is it still time to be 30? Listen to the experience of the past people
AWT introduction
分布式CAP理论
AWT常用组件、FileDialog文件选择框
70000 words of detailed explanation of the whole process of pad openvino [CPU] - from environment configuration to model deployment
buuctf-pwn write-ups (8)
APScheduler如何设置任务不并发(即第一个任务执行完再执行下一个)?
Luogu deep foundation part 1 Introduction to language Chapter 5 array and data batch storage
509. 斐波那契数、爬楼梯所有路径、爬楼梯最小花费
如何判断数组中是否含有某个元素
LayoutManager布局管理器:FlowLayout、BorderLayout、GridLayout、GridBagLayout、CardLayout、BoxLayout
[Excel] 数据透视图
Gridview出现滚动条,组件冲突,如何解决
Detectron:训练自己的数据集——将自己的数据格式转换成COCO格式
2022.7.2-----leetcode. eight hundred and seventy-one
Invalid revision: 3.18.1-g262b901-dirty
JS扁平化数形结构的数组
Input displays the currently selected picture
Nexus 6p从8.0降级6.0+root