当前位置:网站首页>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;
}
边栏推荐
- 安装 Pytorch geometric
- 分布式CAP理论
- The end of the Internet is rural revitalization
- 198. House raiding
- C语言中的函数(详解)
- Design and implementation of redis 7.0 multi part AOF
- Invalid bound statement (not found): com. example. mapper. TblUserRecordMapper. login
- BeanFactoryPostProcessor 与 BeanPostProcessor 相关子类概述
- 2022.7.2-----leetcode. eight hundred and seventy-one
- 如何获取el-tree中所有节点的父节点
猜你喜欢

AWT常用组件、FileDialog文件选择框

Programmers don't talk about morality, and use multithreading for Heisi's girlfriend

Sword finger offer II 038 Daily temperature

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

Webrtc quickly set up video call and video conference

分布式CAP理论

JSON Web Token----JWT和傳統session登錄認證對比

Kubernets first meeting

ES6 modularization

input显示当前选择的图片
随机推荐
Basic concept of bus
QT QTableWidget 表格列置顶需求的思路和代码
2022.7.3-----leetcode. five hundred and fifty-six
Nexus 6p downgraded from 8.0 to 6.0+root
Json Web token - jwt vs. Traditional session login Authentication
input显示当前选择的图片
One click filtering to select Baidu online disk files
如何获取el-tree中所有节点的父节点
Uninstall Google drive hard drive - you must exit the program to uninstall
[microservice] Nacos cluster building and loading file configuration
el-select如何实现懒加载(带搜索功能)
ES6 模块化
Practical gadget instructions
4G wireless all network solar hydrological equipment power monitoring system bms110
How to implement cross domain requests
HMS v1.0 appointment.php editid参数 SQL注入漏洞(CVE-2022-25491)
JSON Web Token----JWT和传统session登录认证对比
检漏继电器JY82-2P
"In simple language programming competition (basic)" part 1 Introduction to language Chapter 3 branch structure programming
Upper computer software development - log information is stored in the database based on log4net