Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
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
pseer
gxpt_ht
Commits
3eab2782
Commit
3eab2782
authored
Nov 06, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化分页接口
parent
5e2c638b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
29 deletions
+29
-29
DeviceServiceImpl.java
...ain/java/share/system/service/impl/DeviceServiceImpl.java
+11
-10
RoomLabelServiceImpl.java
.../java/share/system/service/impl/RoomLabelServiceImpl.java
+6
-7
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+12
-12
No files found.
share-system/src/main/java/share/system/service/impl/DeviceServiceImpl.java
View file @
3eab2782
...
...
@@ -36,6 +36,7 @@ import java.util.ArrayList;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 设备信息Service业务层处理
...
...
@@ -170,10 +171,16 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
@Override
public
TableDataInfo
devicePage
(
DeviceDto
device
)
{
List
<
Device
>
devices
=
deviceMapper
.
selectDeviceList
(
device
);
List
<
DeviceVo
>
deviceVoList
=
convertDosToVos
(
devices
);
TableDataInfo
tableDataInfo
=
new
TableDataInfo
();
PageDomain
pageDomain
=
TableSupport
.
buildPageRequest
();
tableDataInfo
.
setTotal
(
devices
.
size
());
int
start
=
(
pageDomain
.
getPageNum
()
-
1
)
*
pageDomain
.
getPageSize
();
int
end
=
Math
.
min
(
start
+
pageDomain
.
getPageSize
(),
devices
.
size
());
List
<
Device
>
deviceVos
=
devices
.
subList
(
start
,
end
);
List
<
DeviceVo
>
deviceVoList
=
convertDosToVos
(
deviceVos
);
if
(
CollectionUtils
.
isNotEmpty
(
deviceVoList
))
{
List
<
S
Store
>
sStoreList
=
storeMapper
.
selectList
(
new
LambdaQueryWrapper
<>(
));
List
<
S
Room
>
sRoomList
=
roomMapper
.
selectList
(
new
LambdaQueryWrapper
<>(
));
List
<
S
Room
>
sRoomList
=
roomMapper
.
selectList
(
new
LambdaQueryWrapper
<
SRoom
>().
in
(
SRoom:
:
getId
,
deviceVoList
.
stream
().
map
(
DeviceVo:
:
getRoomId
).
collect
(
Collectors
.
toList
())
));
List
<
S
Store
>
sStoreList
=
storeMapper
.
selectList
(
new
LambdaQueryWrapper
<
SStore
>().
in
(
SStore:
:
getId
,
sRoomList
.
stream
().
map
(
SRoom:
:
getStoreId
).
collect
(
Collectors
.
toList
())
));
deviceVoList
.
stream
().
forEach
(
item
->
{
if
(
ObjectUtil
.
isNotEmpty
(
item
.
getRoomId
()))
{
SRoom
sRoom
=
sRoomList
.
stream
().
filter
(
room
->
room
.
getId
().
equals
(
item
.
getRoomId
())).
findFirst
().
orElse
(
null
);
...
...
@@ -188,13 +195,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
});
}
deviceVoList
.
sort
(
Comparator
.
comparing
(
DeviceVo:
:
getCreateTime
).
reversed
());
PageDomain
pageDomain
=
TableSupport
.
buildPageRequest
();
int
start
=
(
pageDomain
.
getPageNum
()
-
1
)
*
pageDomain
.
getPageSize
();
int
end
=
Math
.
min
(
start
+
pageDomain
.
getPageSize
(),
deviceVoList
.
size
());
List
<
DeviceVo
>
deviceVos
=
deviceVoList
.
subList
(
start
,
end
);
TableDataInfo
tableDataInfo
=
new
TableDataInfo
();
tableDataInfo
.
setRows
(
deviceVos
);
tableDataInfo
.
setTotal
(
deviceVoList
.
size
());
tableDataInfo
.
setRows
(
deviceVoList
);
tableDataInfo
.
setCode
(
200
);
tableDataInfo
.
setMsg
(
"查询成功"
);
return
tableDataInfo
;
...
...
share-system/src/main/java/share/system/service/impl/RoomLabelServiceImpl.java
View file @
3eab2782
...
...
@@ -158,17 +158,16 @@ public class RoomLabelServiceImpl extends ServiceImpl<RoomLabelMapper, RoomLabel
@Override
public
TableDataInfo
pageList
(
RoomLabelDto
roomLabel
)
{
List
<
RoomLabel
>
roomLabels
=
roomLabelMapper
.
pageList
(
roomLabel
);
List
<
RoomLabelVo
>
voList
=
doListToVoList
(
roomLabels
);
TableDataInfo
tableDataInfo
=
new
TableDataInfo
();
tableDataInfo
.
setTotal
(
roomLabels
.
size
());
PageDomain
pageDomain
=
TableSupport
.
buildPageRequest
();
Integer
pageNum
=
pageDomain
.
getPageNum
();
Integer
pageSize
=
pageDomain
.
getPageSize
();
int
start
=
(
pageNum
-
1
)
*
pageSize
;
int
end
=
Math
.
min
(
start
+
pageSize
,
voList
.
size
());
List
<
RoomLabelVo
>
pagedList
=
voList
.
subList
(
start
,
end
);
TableDataInfo
tableDataInfo
=
new
TableDataInfo
();
tableDataInfo
.
setRows
(
pagedList
);
tableDataInfo
.
setTotal
(
roomLabels
.
size
());
int
end
=
Math
.
min
(
start
+
pageSize
,
roomLabels
.
size
());
List
<
RoomLabel
>
pagedList
=
roomLabels
.
subList
(
start
,
end
);
List
<
RoomLabelVo
>
voList
=
doListToVoList
(
pagedList
);
tableDataInfo
.
setRows
(
voList
);
tableDataInfo
.
setCode
(
200
);
tableDataInfo
.
setMsg
(
"查询成功"
);
return
tableDataInfo
;
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
3eab2782
...
...
@@ -617,22 +617,22 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Override
public
TableDataInfo
queryOrderList
(
SOrder
sOrder
)
{
List
<
SOrder
>
sOrderList
=
baseMapper
.
queryList
(
sOrder
.
getRoomId
());
List
<
SOrderVo
>
sOrderVos
=
convertDosToVos
(
sOrderList
);
List
<
SStore
>
list
=
storeService
.
list
();
List
<
SRoom
>
list1
=
roomService
.
list
();
sOrderVos
.
stream
().
forEach
(
vo
->
{
vo
.
setRoomName
(
list1
.
stream
().
filter
(
room
->
room
.
getId
().
equals
(
vo
.
getRoomId
())).
findFirst
().
get
().
getName
());
vo
.
setStoreName
(
list
.
stream
().
filter
(
store
->
store
.
getId
().
equals
(
vo
.
getStoreId
())).
findFirst
().
get
().
getName
());
});
TableDataInfo
tableDataInfo
=
new
TableDataInfo
();
tableDataInfo
.
setTotal
(
sOrderList
.
size
());
PageDomain
pageDomain
=
TableSupport
.
buildPageRequest
();
Integer
pageNum
=
pageDomain
.
getPageNum
();
Integer
pageSize
=
pageDomain
.
getPageSize
();
int
start
=
(
pageNum
-
1
)
*
pageSize
;
int
end
=
Math
.
min
(
start
+
pageSize
,
sOrderVos
.
size
());
List
<
SOrderVo
>
pagedList
=
sOrderVos
.
subList
(
start
,
end
);
TableDataInfo
tableDataInfo
=
new
TableDataInfo
();
tableDataInfo
.
setRows
(
pagedList
);
tableDataInfo
.
setTotal
(
sOrderVos
.
size
());
int
end
=
Math
.
min
(
start
+
pageSize
,
sOrderList
.
size
());
List
<
SOrder
>
pagedList
=
sOrderList
.
subList
(
start
,
end
);
List
<
SOrderVo
>
sOrderVos
=
convertDosToVos
(
pagedList
);
// List<SStore> list = storeService.list();
// List<SRoom> list1 = roomService.list();
// sOrderVos.stream().forEach(vo -> {
// vo.setRoomName(list1.stream().filter(room -> room.getId().equals(vo.getRoomId())).findFirst().get().getName());
// vo.setStoreName(list.stream().filter(store -> store.getId().equals(vo.getStoreId())).findFirst().get().getName());
// });
tableDataInfo
.
setRows
(
sOrderVos
);
tableDataInfo
.
setCode
(
200
);
tableDataInfo
.
setMsg
(
"查询成功"
);
return
tableDataInfo
;
...
...
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