Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
pension
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mengmeng
pension
Commits
675396ef
Commit
675396ef
authored
May 07, 2021
by
Shen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 添加分页util工具类(暂未使用)
parent
624b77e9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
SubListForPageUtil.java
...rc/main/java/io/hmit/common/utils/SubListForPageUtil.java
+32
-0
No files found.
hmit-common/src/main/java/io/hmit/common/utils/SubListForPageUtil.java
0 → 100644
View file @
675396ef
package
io
.
hmit
.
common
.
utils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Description :
* @Author : Shen Yuanfeng
* @Date : 2021/5/7 9:49
*/
public
class
SubListForPageUtil
{
public
static
<
T
>
List
<
T
>
getSubList
(
Map
<
String
,
Object
>
params
,
List
<
T
>
list
){
Integer
pageNum
=
Integer
.
parseInt
(
params
.
get
(
"page"
).
toString
());
Integer
pageSize
=
Integer
.
parseInt
(
params
.
get
(
"limit"
).
toString
());
Integer
count
=
list
.
size
();
Integer
pageNo
=
(
pageNum
-
1
)
*
pageSize
;
List
<
T
>
list2
;
if
(
pageNo
+
pageSize
>
count
)
{
if
(
pageNo
>
count
){
list2
=
new
ArrayList
<>();
}
else
{
list2
=
list
.
subList
(
pageNo
,
count
);
}
}
else
{
list2
=
list
.
subList
(
pageNo
,
pageNo
+
pageSize
);
}
return
list2
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment