Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
operation-control-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王锦盛
operation-control-platform
Commits
e135f2be
Commit
e135f2be
authored
Mar 09, 2022
by
huxiuwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
胡秀武:模型分类接口返回字段调整
parent
8286c4a4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
11 deletions
+23
-11
src/main/java/com/pms/ocp/controller/ModelBaseController.java
...main/java/com/pms/ocp/controller/ModelBaseController.java
+2
-0
src/main/java/com/pms/ocp/model/vo/OcpModelGroupVO.java
src/main/java/com/pms/ocp/model/vo/OcpModelGroupVO.java
+7
-0
src/main/java/com/pms/ocp/service/impl/ModelClassifyServiceImpl.java
...va/com/pms/ocp/service/impl/ModelClassifyServiceImpl.java
+14
-11
No files found.
src/main/java/com/pms/ocp/controller/ModelBaseController.java
View file @
e135f2be
...
@@ -16,6 +16,8 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -16,6 +16,8 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
static
com
.
pms
.
ocp
.
common
.
constants
.
CodeEnum
.
REQUIRED_PARAMETER_EMPTY
;
import
static
com
.
pms
.
ocp
.
common
.
constants
.
CodeEnum
.
REQUIRED_PARAMETER_EMPTY
;
/**
/**
...
...
src/main/java/com/pms/ocp/model/vo/OcpModelGroupVO.java
View file @
e135f2be
...
@@ -40,6 +40,13 @@ public class OcpModelGroupVO implements Serializable {
...
@@ -40,6 +40,13 @@ public class OcpModelGroupVO implements Serializable {
*/
*/
@ApiModelProperty
(
value
=
"上级模型分类id"
)
@ApiModelProperty
(
value
=
"上级模型分类id"
)
private
String
modelGroupPcode
;
private
String
modelGroupPcode
;
/**
* 上级模型分类id
*/
@ApiModelProperty
(
value
=
"上级模型分类名称"
)
@TableField
(
exist
=
false
)
private
String
modelGroupPName
;
/**
/**
* 分类版本
* 分类版本
*/
*/
...
...
src/main/java/com/pms/ocp/service/impl/ModelClassifyServiceImpl.java
View file @
e135f2be
...
@@ -16,6 +16,8 @@ import org.springframework.stereotype.Service;
...
@@ -16,6 +16,8 @@ import org.springframework.stereotype.Service;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
/**
* @author huxiuwu
* @author huxiuwu
...
@@ -61,9 +63,10 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
...
@@ -61,9 +63,10 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
@Override
@Override
public
ResponseVO
<
PageInfo
<
OcpModelGroupVO
>>
subclassDetailsList
(
int
pageSize
,
int
pageNum
,
String
parentGroupCode
,
String
subclassGroupName
)
{
public
ResponseVO
<
PageInfo
<
OcpModelGroupVO
>>
subclassDetailsList
(
int
pageSize
,
int
pageNum
,
String
parentGroupCode
,
String
subclassGroupName
)
{
PageHelper
.
startPage
(
pageSize
,
pageNum
);
PageHelper
.
startPage
(
pageSize
,
pageNum
);
List
<
OcpModelGroupVO
>
ocpModelGroupVOList
=
this
.
selectByCondition
(
null
,
null
);
List
<
OcpModelGroupVO
>
ocpModelGroupVOList
=
this
.
selectByCondition
(
null
,
subclassGroupName
);
LinkedList
<
OcpModelGroupVO
>
childrenList
=
new
LinkedList
<>();
Map
<
String
,
OcpModelGroupVO
>
groupByCode
=
ocpModelGroupVOList
.
stream
().
collect
(
Collectors
.
toMap
(
OcpModelGroupVO:
:
getModelGroupCode
,
Function
.
identity
(),
(
key1
,
key2
)
->
key2
));
findChildren
(
ocpModelGroupVOList
,
parentGroupCode
,
childrenList
);
OcpModelGroupVO
ocpModelGroupVO
=
groupByCode
.
get
(
parentGroupCode
);
List
<
OcpModelGroupVO
>
childrenList
=
findChildren
(
ocpModelGroupVOList
,
ocpModelGroupVO
,
new
LinkedList
<>());
PageInfo
<
OcpModelGroupVO
>
pageInfo
=
new
PageInfo
<>(
childrenList
);
PageInfo
<
OcpModelGroupVO
>
pageInfo
=
new
PageInfo
<>(
childrenList
);
return
ResponseVO
.
ok
(
pageInfo
);
return
ResponseVO
.
ok
(
pageInfo
);
}
}
...
@@ -107,20 +110,20 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
...
@@ -107,20 +110,20 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
* @author huxiuwu
* @author huxiuwu
* @date 2022/3/9
* @date 2022/3/9
* @param menuList
* @param menuList
* @param pid
* @param childMenu
* @param childMenu
* @return void
* @return void
**/
**/
private
void
findChildren
(
List
<
OcpModelGroupVO
>
menuList
,
String
pid
,
List
<
OcpModelGroupVO
>
childMenu
)
{
private
List
<
OcpModelGroupVO
>
findChildren
(
List
<
OcpModelGroupVO
>
menuList
,
OcpModelGroupVO
parent
,
List
<
OcpModelGroupVO
>
childMenu
)
{
for
(
OcpModelGroupVO
mu
:
menuList
)
{
for
(
OcpModelGroupVO
vo
:
menuList
)
{
//遍历出父id等于参数的id,add进子节点集合
//遍历出父id等于参数的id,add进子节点集合
if
(
p
id
!=
null
&&
pid
.
equals
(
mu
.
getModelGroupPcode
()))
{
if
(
p
arent
.
getModelGroupCode
()
!=
null
&&
parent
.
getModelGroupCode
().
equals
(
vo
.
getModelGroupPcode
()))
{
//递归遍历下一级
//递归遍历下一级
childMenu
.
add
(
mu
);
vo
.
setModelGroupPName
(
parent
.
getModelGroupName
());
findChildren
(
menuList
,
mu
.
getModelGroupCode
(),
childMenu
);
childMenu
.
add
(
vo
);
childMenu
=
findChildren
(
menuList
,
vo
,
childMenu
);
}
}
}
}
return
childMenu
;
}
}
...
@@ -153,7 +156,7 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
...
@@ -153,7 +156,7 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
QueryWrapper
<
OcpModelGroupVO
>
queryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
OcpModelGroupVO
>
queryWrapper
=
new
QueryWrapper
<>();
//根据是否传入搜索条件创建构造器进行查询
//根据是否传入搜索条件创建构造器进行查询
queryWrapper
.
eq
(
StringUtils
.
isNotEmpty
(
searchCondition
[
0
]),
"model_group_pcode"
,
searchCondition
[
1
])
queryWrapper
.
eq
(
StringUtils
.
isNotEmpty
(
searchCondition
[
0
]),
"model_group_pcode"
,
searchCondition
[
1
])
.
like
(
StringUtils
.
isNotEmpty
(
searchCondition
[
0
]),
"model_group_name"
,
searchCondition
[
0
]);
.
like
(
StringUtils
.
isNotEmpty
(
searchCondition
[
1
]),
"model_group_name"
,
searchCondition
[
0
]);
return
classifyMapper
.
selectList
(
queryWrapper
);
return
classifyMapper
.
selectList
(
queryWrapper
);
}
}
}
}
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