当前位置:网站首页>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 to determine whether an array contains an element
- HMS v1.0 appointment.php editid参数 SQL注入漏洞(CVE-2022-25491)
- How much computing power does transformer have
- How to solve the component conflicts caused by scrollbars in GridView
- Component、Container容器常用API详解:Frame、Panel、ScrollPane
- 每周小结(*63):关于正能量
- Excel 比较日器
- Basic concept of bus
- Invalid revision: 3.18.1-g262b901-dirty
- Fast power (template)
猜你喜欢
Design and implementation of redis 7.0 multi part AOF
Compound nonlinear feedback control (2)
A little understanding of GSLB (global server load balance) technology
Leetcode question brushing record | 206_ Reverse linked list
Canoe panel learning video
JS flattened array of number shape structure
C language exercises (recursion)
How to get the parent node of all nodes in El tree
Webrtc quickly set up video call and video conference
AWT介绍
随机推荐
分布式CAP理论
JS get the attribute values nested in the object
How to implement lazy loading in El select (with search function)
Input displays the currently selected picture
QT releases multilingual International Translation
How to avoid JVM memory leakage?
C language exercises (recursion)
Accidentally deleted the data file of Clickhouse, can it be restored?
对List进行排序工具类,可以对字符串排序
How to choose the middle-aged crisis of the testing post? Stick to it or find another way out? See below
Uninstall Google drive hard drive - you must exit the program to uninstall
Design and implementation of redis 7.0 multi part AOF
js获取对象中嵌套的属性值
"In simple language programming competition (basic)" part 1 Introduction to language Chapter 3 branch structure programming
[Excel] 数据透视图
Excel comparator
Kubernets first meeting
APScheduler如何设置任务不并发(即第一个任务执行完再执行下一个)?
How to get the parent node of all nodes in El tree
Functions in C language (detailed explanation)