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 0f7f122e
authored
Nov 22, 2023
by
chamberone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 服务范围添加排序
1 parent
6bc91fe9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
5 deletions
project-order/src/main/java/com/dituhui/pea/order/controller/BusinessBlockController.java
project-order/src/main/java/com/dituhui/pea/order/service/BusinessBlockService.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessBlockServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/controller/BusinessBlockController.java
View file @
0f7f122
...
...
@@ -6,6 +6,8 @@ import com.dituhui.pea.order.dto.BusinessServiceBlockAddReqDTO;
import
com.dituhui.pea.order.dto.BusinessServiceBlockRemoveReqDTO
;
import
com.dituhui.pea.order.dto.BusinessServiceBlockUpdateReqDTO
;
import
com.dituhui.pea.order.service.BusinessBlockService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -26,16 +28,29 @@ public class BusinessBlockController {
* @param size 分页-页大小
* @param layerId 图层ID(筛选项)
* @param teamId 小队ID(筛选项)
* @param orderBy 排序字段 默认"teamId"
* @param direction 排序方向 desc降序/asc升序 默认"asc"
* @return
*/
@GetMapping
(
"/business/service/block/list"
)
public
Result
<?>
businessSeverBlocks
(
@RequestParam
String
levelType
,
@RequestParam
String
levelValue
,
@RequestParam
int
page
,
@RequestParam
int
size
,
@RequestParam
(
required
=
false
)
String
layerId
,
@RequestParam
(
required
=
false
)
String
teamId
)
{
@RequestParam
(
required
=
false
)
String
teamId
,
@RequestParam
(
required
=
false
)
String
orderBy
,
@RequestParam
(
required
=
false
)
String
direction
)
{
if
(
StringUtils
.
isEmpty
(
teamId
))
{
teamId
=
"teamId"
;
}
if
(
StringUtils
.
isEmpty
(
direction
))
{
direction
=
"asc"
;
}
Result
<?>
res
=
null
;
try
{
res
=
businessBlockService
.
businessServerBlocks
(
levelType
,
levelValue
,
page
,
size
,
layerId
,
teamId
);
res
=
businessBlockService
.
businessServerBlocks
(
levelType
,
levelValue
,
page
,
size
,
layerId
,
teamId
,
orderBy
,
direction
);
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
...
...
project-order/src/main/java/com/dituhui/pea/order/service/BusinessBlockService.java
View file @
0f7f122
...
...
@@ -4,7 +4,7 @@ import com.dituhui.pea.common.Result;
public
interface
BusinessBlockService
{
Result
<?>
businessServerBlocks
(
String
levelType
,
String
levelValue
,
int
page
,
int
size
,
String
layerId
,
String
teamId
);
Result
<?>
businessServerBlocks
(
String
levelType
,
String
levelValue
,
int
page
,
int
size
,
String
layerId
,
String
teamId
,
String
orderBy
,
String
direction
);
Result
<?>
businessServiceBlockAdd
(
String
layerId
,
String
teamId
);
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessBlockServiceImpl.java
View file @
0f7f122
...
...
@@ -62,7 +62,7 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
private
EncryptionUtil
encryptionUtil
;
@Override
public
Result
<?>
businessServerBlocks
(
String
levelType
,
String
levelValue
,
int
page
,
int
size
,
String
layerId
,
String
teamId
)
{
public
Result
<?>
businessServerBlocks
(
String
levelType
,
String
levelValue
,
int
page
,
int
size
,
String
layerId
,
String
teamId
,
String
orderBy
,
String
direction
)
{
BusinessServerBlocksRespDTO
resp
=
new
BusinessServerBlocksRespDTO
();
List
<
OrgTeamEntity
>
teams
=
new
ArrayList
<>();
...
...
@@ -116,7 +116,19 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
}
return
criteriaBuilder
.
and
(
statusPredicate
,
teamIdPredicate
,
layerIdPredicate
);
};
Sort
sort
=
Sort
.
by
(
Sort
.
Order
.
asc
(
"teamId"
));
Sort
sort
=
null
;
switch
(
direction
)
{
case
"asc"
:
case
"ASC"
:
case
"Asc"
:
sort
=
Sort
.
by
(
Sort
.
Order
.
asc
(
orderBy
));
break
;
case
"desc"
:
case
"DESC"
:
case
"Desc"
:
sort
=
Sort
.
by
(
Sort
.
Order
.
desc
(
orderBy
));
break
;
}
PageRequest
pageRequest
=
PageRequest
.
of
(
page
-
1
,
size
,
sort
);
Page
<
MapBlockInfoEntity
>
pg
=
mapBlockInfoDao
.
findAll
(
specification
,
pageRequest
);
...
...
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