当前位置:网站首页>手动对list进行分页(参数list ,当前页,页面大小)
手动对list进行分页(参数list ,当前页,页面大小)
2022-07-04 06:00:00 【hello宋先深】
/**
* 对结果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;
}
边栏推荐
- What are the reasons for the frequent high CPU of ECS?
- HMS v1.0 appointment. PHP editid parameter SQL injection vulnerability (cve-2022-25491)
- 检漏继电器JY82-2P
- Design and implementation of redis 7.0 multi part AOF
- JS execution mechanism
- BUU-Pwn-test_ your_ nc
- Risc-v-qemu-virt in FreeRTOS_ Lock mechanism analysis of GCC
- left_and_right_net正常版本
- Qt发布多语言国际化翻译
- JSON Web Token----JWT和傳統session登錄認證對比
猜你喜欢
![[microservice] Nacos cluster building and loading file configuration](/img/50/7af220c57a06eb186729c9882d9dab.png)
[microservice] Nacos cluster building and loading file configuration

How to get the parent node of all nodes in El tree

Experience weekly report no. 102 (July 4, 2022)

每周小结(*63):关于正能量

How to configure static IP for Kali virtual machine

接地继电器DD-1/60

724. Find the central subscript of the array

Google Chrome browser will support the function of selecting text translation

JSON Web Token----JWT和传统session登录认证对比

Kubernets first meeting
随机推荐
19. Framebuffer application programming
JS flattened array of number shape structure
Introduction to AMBA
注释与注解
Input displays the currently selected picture
QT qtablewidget table column top requirements ideas and codes
How to solve the component conflicts caused by scrollbars in GridView
How does apscheduler set tasks not to be concurrent (that is, execute the next task after the first one)?
724. Find the central subscript of the array
检漏继电器JY82-2P
测试岗的中年危机该如何选择?是坚守还是另寻出路?且看下文
AWT常用组件、FileDialog文件选择框
Grounding relay dd-1/60
2022.7.2-----leetcode.871
AWT介绍
(4) Canal multi instance use
配置交叉编译工具链和环境变量
BUU-Pwn-test_ your_ nc
复合非线性反馈控制(二)
High performance parallel programming and optimization | lesson 02 homework at home