Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nouiWithSpringMVC
Overview
Overview
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
gechengyang
nouiWithSpringMVC
Commits
e0480f91
Commit
e0480f91
authored
Aug 09, 2022
by
WeiCong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化分页查询响应返回页号逻辑
parent
3ca1d187
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
AbstractCache.java
...n/java/org/sss/presentation/noui/cache/AbstractCache.java
+16
-3
No files found.
src/main/java/org/sss/presentation/noui/cache/AbstractCache.java
View file @
e0480f91
...
...
@@ -173,11 +173,24 @@ public abstract class AbstractCache implements CacheController {
int
total
=
moduleList
.
fullSize
();
int
index
=
paginationItem
.
get
(
Constants
.
PAGINATION_INDEX
);
int
pageSize
=
paginationItem
.
get
(
Constants
.
PAGINATION_PAGESIZE
);
if
(
total
<
pageSize
*
index
)
{
index
=
(
total
%
pageSize
!=
0
)
?
(
total
/
pageSize
+
1
)
:
total
/
pageSize
;
}
index
=
getPage
(
index
,
pageSize
,
total
);
paginationInfo
.
put
(
Constants
.
PAGINATION_TOTAL
,
total
);
paginationInfo
.
put
(
Constants
.
PAGINATION_INDEX
,
index
);
return
paginationInfo
;
}
private
static
int
getPage
(
int
index
,
int
pageSize
,
int
total
)
{
if
(
pageSize
<=
0
)
{
return
0
;
}
index
=
index
>=
1
?
(
index
<=
getPages
(
pageSize
,
total
)
?
index
:
getPages
(
pageSize
,
total
))
:
1
;
return
index
;
}
private
static
int
getPages
(
int
pageSize
,
int
total
)
{
if
(
pageSize
<=
0
)
{
return
0
;
}
return
total
%
pageSize
==
0
?
total
/
pageSize
:
total
/
pageSize
+
1
;
}
}
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