Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
api
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
首航-临时账号
api
Commits
da56fc60
Commit
da56fc60
authored
Nov 19, 2020
by
java-李谡
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改分页
parent
0ce6d7b0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
13 deletions
+23
-13
StatisticalController.java
src/com/ejweb/modules/airport/api/StatisticalController.java
+2
-2
StatisticalService.java
src/com/ejweb/modules/airport/service/StatisticalService.java
+21
-11
No files found.
src/com/ejweb/modules/airport/api/StatisticalController.java
View file @
da56fc60
...
...
@@ -105,7 +105,6 @@ public class StatisticalController {
StatisticalListBean
bean
=
requestBean
.
getObjectBean
(
StatisticalListBean
.
class
);
String
message
=
statisticalService
.
validate
(
bean
);
if
(
message
==
null
)
{
bean
.
setPageSize
(
1000
);
// 参数校验为通过
PageEntity
<
StatisticalListEntity
>
list
=
statisticalService
.
getList
(
bean
);
// 查询结果为空
...
...
@@ -130,7 +129,8 @@ public class StatisticalController {
StatisticalListBean
bean
=
requestBean
.
getObjectBean
(
StatisticalListBean
.
class
);
String
message
=
statisticalService
.
validate
(
bean
);
if
(
message
==
null
)
{
bean
.
setPageSize
(
1000
);
bean
.
setPageNo
(
1
);
bean
.
setPageSize
(
9999999
);
// 参数校验为通过
PageEntity
<
StatisticalListEntity
>
page
=
statisticalService
.
getList
(
bean
);
List
<
StatisticalListEntity
>
list
=
new
ArrayList
<
StatisticalListEntity
>();
...
...
src/com/ejweb/modules/airport/service/StatisticalService.java
View file @
da56fc60
...
...
@@ -14,6 +14,7 @@ import com.ejweb.modules.airport.entity.StatisticalListEntity;
import
com.ejweb.modules.verify.bean.AirlineVerifiedAddBean
;
import
com.ejweb.modules.verify.dao.AirlineVerifiedDao
;
import
com.ejweb.modules.verify.dao.AirlineVerifyDao
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -142,27 +143,36 @@ public class StatisticalService extends BaseService<StatisticalDao> {
public
PageEntity
<
StatisticalListEntity
>
getList
(
StatisticalListBean
statisticalListBean
){
PageEntity
<
StatisticalListEntity
>
page
=
new
PageEntity
<
StatisticalListEntity
>();
PageInfo
<
StatisticalListEntity
>
pageInfo
=
null
;
List
<
StatisticalListEntity
>
lists
=
null
;
lists
=
statisticalDao
.
getList
(
statisticalListBean
);
if
(
Objects
.
nonNull
(
statisticalListBean
.
getAirlineStatus
())){
if
(
Objects
.
nonNull
(
statisticalListBean
.
getAirlineStatus
()))
{
//使用迭代器进行筛选
Iterator
<
StatisticalListEntity
>
iter
=
lists
.
iterator
();
while
(
iter
.
hasNext
())
{
//当此对象状态与传入状态不一致时remove对象
if
(
iter
.
next
().
getAirlineStatus
()
!=
statisticalListBean
.
getAirlineStatus
()){
if
(
iter
.
next
().
getAirlineStatus
()
!=
statisticalListBean
.
getAirlineStatus
())
{
iter
.
remove
();
}
}
}
pageInfo
=
new
PageInfo
<
StatisticalListEntity
>(
lists
);
page
.
setPageNo
(
pageInfo
.
getPageNum
());
page
.
setPageSize
(
pageInfo
.
getPageSize
());
page
.
setCount
(
pageInfo
.
getTotal
());
page
.
setTotalPage
(
pageInfo
.
getPages
());
page
.
setList
(
pageInfo
.
getList
());
return
page
;
//创建Page类
Page
page
=
new
Page
(
statisticalListBean
.
getPageNo
(),
statisticalListBean
.
getPageSize
());
//为Page类中的total属性赋值
int
total
=
lists
.
size
();
page
.
setTotal
(
total
);
//计算当前需要显示的数据下标起始值
int
startIndex
=
(
statisticalListBean
.
getPageNo
()
-
1
)
*
statisticalListBean
.
getPageSize
();
int
endIndex
=
Math
.
min
(
startIndex
+
statisticalListBean
.
getPageSize
(),
total
);
//从链表中截取需要显示的子链表,并加入到Page
page
.
addAll
(
lists
.
subList
(
startIndex
,
endIndex
));
//以Page创建PageInfo
PageEntity
<
StatisticalListEntity
>
pageEntity
=
new
PageEntity
<>();
pageEntity
.
setPageNo
(
page
.
getPageNum
());
pageEntity
.
setPageSize
(
page
.
getPageSize
());
pageEntity
.
setCount
(
page
.
getTotal
());
pageEntity
.
setTotalPage
(
page
.
getPages
());
pageEntity
.
setList
(
page
.
getResult
());
return
pageEntity
;
}
}
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