Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 055497a7
authored
Aug 07, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配件仓不需要翻页,查询一次性返回
1 parent
0e1263d8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
20 deletions
project-order/src/main/java/com/dituhui/pea/order/dao/OrgWarehouseInfoDao.java
project-order/src/main/java/com/dituhui/pea/order/dto/BusinessOrgWarehousesDTO.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessBaseServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/dao/OrgWarehouseInfoDao.java
View file @
055497a
...
...
@@ -29,9 +29,7 @@ public interface OrgWarehouseInfoDao extends JpaRepository<OrgWarehouseInfoEntit
@Query
(
"select a from OrgWarehouseInfoEntity a join OrgBranchEntity o on a.branchId=o.branchId where o.clusterId=:clusterId"
)
Page
<
OrgWarehouseInfoEntity
>
findByClusterId
(
String
clusterId
,
Pageable
pageable
);
List
<
OrgWarehouseInfoEntity
>
findByClusterId
(
String
clusterId
);
Page
<
OrgWarehouseInfoEntity
>
findByBranchId
(
String
branchId
,
Pageable
pageable
);
Page
<
OrgWarehouseInfoEntity
>
findByGroupId
(
String
groupId
,
Pageable
pageable
);
List
<
OrgWarehouseInfoEntity
>
findByGroupId
(
String
groupId
);
}
project-order/src/main/java/com/dituhui/pea/order/dto/BusinessOrgWarehousesDTO.java
View file @
055497a
...
...
@@ -12,17 +12,11 @@ public class BusinessOrgWarehousesDTO {
public
static
class
Request
{
private
String
levelType
;
private
String
levelValue
;
private
Integer
size
=
DEFAULT_PAGE_SIZE
;
private
Integer
page
=
1
;
}
@lombok
.
Data
@Accessors
(
chain
=
true
)
public
static
class
Result
{
private
long
pageCurrent
;
private
long
pages
;
private
long
pageSize
;
private
long
total
;
private
List
<
Content
>
content
;
}
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessBaseServiceImpl.java
View file @
055497a
...
...
@@ -67,17 +67,16 @@ public class BusinessBaseServiceImpl implements BusinessBaseService {
@Override
public
Result
<?>
getOrgWarehouses
(
BusinessOrgWarehousesDTO
.
Request
req
)
{
Pageable
pageable
=
PageRequest
.
of
(
req
.
getPage
()
-
1
,
req
.
getSize
());
Page
<
OrgWarehouseInfoEntity
>
page
=
null
;
List
<
OrgWarehouseInfoEntity
>
entities
=
null
;
if
(
req
.
getLevelType
().
equals
(
"cluster"
))
{
page
=
orgWarehouseInfoDao
.
findByClusterId
(
req
.
getLevelValue
(),
pageable
);
entities
=
orgWarehouseInfoDao
.
findByClusterId
(
req
.
getLevelValue
()
);
}
else
if
(
req
.
getLevelType
().
equals
(
"branch"
))
{
page
=
orgWarehouseInfoDao
.
findByBranchId
(
req
.
getLevelValue
(),
pageable
);
entities
=
orgWarehouseInfoDao
.
findByBranchId
(
req
.
getLevelValue
()
);
}
else
{
page
=
orgWarehouseInfoDao
.
findByGroupId
(
req
.
getLevelValue
(),
pageable
);
entities
=
orgWarehouseInfoDao
.
findByGroupId
(
req
.
getLevelValue
()
);
}
List
<
BusinessOrgWarehousesDTO
.
Content
>
contents
=
page
.
getContent
()
.
stream
().
map
(
e
->
{
List
<
BusinessOrgWarehousesDTO
.
Content
>
contents
=
entities
.
stream
().
map
(
e
->
{
BusinessOrgWarehousesDTO
.
Content
content
=
new
BusinessOrgWarehousesDTO
.
Content
();
content
.
setWarehouseId
(
e
.
getWarehouseId
());
content
.
setWarehouseName
(
e
.
getWarehouseName
());
...
...
@@ -95,10 +94,6 @@ public class BusinessBaseServiceImpl implements BusinessBaseService {
return
content
;
}).
collect
(
Collectors
.
toList
());
BusinessOrgWarehousesDTO
.
Result
rs
=
new
BusinessOrgWarehousesDTO
.
Result
();
rs
.
setTotal
(
page
.
getTotalElements
())
.
setPages
(
page
.
getTotalPages
())
.
setPageSize
(
page
.
getSize
())
.
setPageCurrent
(
page
.
getNumber
());
rs
.
setContent
(
contents
);
return
Result
.
success
(
rs
);
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment