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
b9a1cf83
Commit
b9a1cf83
authored
Mar 10, 2022
by
liukai
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
6d93ec61
385d8f2f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
28 deletions
+70
-28
src/main/java/com/pms/ocp/controller/ModelClassifyController.java
.../java/com/pms/ocp/controller/ModelClassifyController.java
+6
-6
src/main/java/com/pms/ocp/model/vo/OcpModelGroupVO.java
src/main/java/com/pms/ocp/model/vo/OcpModelGroupVO.java
+11
-1
src/main/java/com/pms/ocp/service/ModelClassifyService.java
src/main/java/com/pms/ocp/service/ModelClassifyService.java
+2
-2
src/main/java/com/pms/ocp/service/impl/ModelClassifyServiceImpl.java
...va/com/pms/ocp/service/impl/ModelClassifyServiceImpl.java
+51
-19
No files found.
src/main/java/com/pms/ocp/controller/ModelClassifyController.java
View file @
b9a1cf83
...
@@ -37,8 +37,8 @@ public class ModelClassifyController {
...
@@ -37,8 +37,8 @@ public class ModelClassifyController {
**/
**/
@ApiOperation
(
"模型分类导航"
)
@ApiOperation
(
"模型分类导航"
)
@GetMapping
(
"/navigation"
)
@GetMapping
(
"/navigation"
)
public
ResponseVO
<
List
<
OcpModelGroupVO
>>
getModelNavigation
(
String
searchCondition
)
{
public
ResponseVO
<
List
<
OcpModelGroupVO
>>
getModelNavigation
()
{
return
modelClassifyService
.
getModelNavigation
(
searchCondition
);
return
modelClassifyService
.
getModelNavigation
();
}
}
/**
/**
...
@@ -50,12 +50,12 @@ public class ModelClassifyController {
...
@@ -50,12 +50,12 @@ public class ModelClassifyController {
**/
**/
@ApiOperation
(
"右侧子类详情列表"
)
@ApiOperation
(
"右侧子类详情列表"
)
@GetMapping
(
"/subclassDetailsList"
)
@GetMapping
(
"/subclassDetailsList"
)
public
ResponseVO
<
PageInfo
<
OcpModelGroupVO
>>
subclassDetailsList
(
@RequestParam
(
required
=
false
)
int
pageSiz
e
,
public
ResponseVO
<
PageInfo
<
OcpModelGroupVO
>>
subclassDetailsList
(
@RequestParam
int
currentPag
e
,
@RequestParam
(
required
=
false
)
int
pageNum
,
@RequestParam
int
pageSize
,
@RequestParam
(
required
=
false
,
defaultValue
=
""
)
String
parentGroupCode
,
@RequestParam
(
required
=
false
,
defaultValue
=
""
)
String
parentGroupCode
,
@RequestParam
(
required
=
false
)
String
subclassGroupName
@RequestParam
(
required
=
false
,
defaultValue
=
""
)
String
subclassGroupName
)
{
)
{
return
modelClassifyService
.
subclassDetailsList
(
pageSize
,
pageNum
,
parentGroupCode
,
subclassGroupName
);
return
modelClassifyService
.
subclassDetailsList
(
currentPage
,
pageSize
,
parentGroupCode
,
subclassGroupName
);
}
}
/**
/**
...
...
src/main/java/com/pms/ocp/model/vo/OcpModelGroupVO.java
View file @
b9a1cf83
...
@@ -88,13 +88,23 @@ public class OcpModelGroupVO implements Serializable {
...
@@ -88,13 +88,23 @@ public class OcpModelGroupVO implements Serializable {
@ApiModelProperty
(
value
=
"是否已删除0未删除 1未删除"
)
@ApiModelProperty
(
value
=
"是否已删除0未删除 1未删除"
)
private
Integer
isDelete
;
private
Integer
isDelete
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"层级"
)
private
int
level
;
/**
/**
* 子类集合
* 子类集合
*/
*/
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"子类集合"
)
@ApiModelProperty
(
value
=
"子类集合"
)
List
<
OcpModelGroupVO
>
childrenList
;
private
List
<
OcpModelGroupVO
>
childrenList
;
public
String
getModelGroupCode
()
{
return
modelGroupCode
==
null
?
""
:
modelGroupCode
;
}
public
String
getModelGroupPcode
()
{
return
modelGroupPcode
==
null
?
""
:
modelGroupPcode
;
}
}
}
...
...
src/main/java/com/pms/ocp/service/ModelClassifyService.java
View file @
b9a1cf83
...
@@ -12,11 +12,11 @@ import java.util.List;
...
@@ -12,11 +12,11 @@ import java.util.List;
* @date 2022/3/8 15:19
* @date 2022/3/8 15:19
*/
*/
public
interface
ModelClassifyService
{
public
interface
ModelClassifyService
{
ResponseVO
<
List
<
OcpModelGroupVO
>>
getModelNavigation
(
String
searchCondition
);
ResponseVO
<
List
<
OcpModelGroupVO
>>
getModelNavigation
();
ResponseVO
insert
(
List
<
ModelType
>
list
);
ResponseVO
insert
(
List
<
ModelType
>
list
);
ResponseVO
subclassDetailsList
(
int
pageSize
,
int
pageNum
,
String
parentGroupCode
,
String
subclassGroupName
);
ResponseVO
subclassDetailsList
(
int
currentPage
,
int
pageSize
,
String
parentGroupCode
,
String
subclassGroupName
);
ResponseVO
update
(
List
<
ModelType
>
list
);
ResponseVO
update
(
List
<
ModelType
>
list
);
}
}
src/main/java/com/pms/ocp/service/impl/ModelClassifyServiceImpl.java
View file @
b9a1cf83
...
@@ -34,17 +34,17 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
...
@@ -34,17 +34,17 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
private
OcpModelGroupService
ocpService
;
private
OcpModelGroupService
ocpService
;
/**
/**
* currentPage pageSize
* 模型分类-导航树
* 模型分类-导航树
*
*
* @param searchCondition 搜索条件
* @return List<com.pms.ocp.model.vo.OcpModelGroupVO>
* @return List<com.pms.ocp.model.vo.OcpModelGroupVO>
* @author huxiuwu
* @author huxiuwu
* @date 2022/3/8
* @date 2022/3/8
**/
**/
@Override
@Override
public
ResponseVO
<
List
<
OcpModelGroupVO
>>
getModelNavigation
(
String
searchCondition
)
{
public
ResponseVO
<
List
<
OcpModelGroupVO
>>
getModelNavigation
()
{
//根据是否传入搜索条件创建构造器进行查询
//根据是否传入搜索条件创建构造器进行查询
List
<
OcpModelGroupVO
>
modelTypeList
=
this
.
selectByCondition
(
searchCondition
,
null
);
List
<
OcpModelGroupVO
>
modelTypeList
=
this
.
selectByCondition
(
null
,
null
);
if
(
CollectionUtil
.
isEmpty
(
modelTypeList
))
{
if
(
CollectionUtil
.
isEmpty
(
modelTypeList
))
{
return
ResponseVO
.
error
(
CodeEnum
.
NO_DATA
);
return
ResponseVO
.
error
(
CodeEnum
.
NO_DATA
);
}
}
...
@@ -55,18 +55,26 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
...
@@ -55,18 +55,26 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
/**
/**
* 右侧子类详情列表
* 右侧子类详情列表
*
* 这边是右侧详情页,需求是点击右侧导航树上的分类显示该分类的所有子集,
* 所以第一次查询查询到所有并将其转换为key为其分类编码,value为其本身
* 的map.第二次是根据搜素框的值进行模糊查询
* @return pms.ocp.model.vo.ResponseVO
* @return pms.ocp.model.vo.ResponseVO
* @author huxiuwu
* @author huxiuwu
* @date 2022/3/9
* @date 2022/3/9
**/
**/
@Override
@Override
public
ResponseVO
<
PageInfo
<
OcpModelGroupVO
>>
subclassDetailsList
(
int
pageSize
,
int
pageNum
,
String
parentGroupCode
,
String
subclassGroupName
)
{
public
ResponseVO
<
PageInfo
<
OcpModelGroupVO
>>
subclassDetailsList
(
int
currentPage
,
int
pageSize
,
String
parentGroupCode
,
String
subclassGroupName
)
{
PageHelper
.
startPage
(
pageSize
,
pageNum
);
//查询所有
List
<
OcpModelGroupVO
>
ocpModelGroupVOList
=
this
.
selectByCondition
(
null
,
subclassGroupName
);
List
<
OcpModelGroupVO
>
ocpModelGroupVOList
=
this
.
selectByCondition
(
null
,
null
);
//将查询到所有数据的list转换为key为分类code,value为本身的map
Map
<
String
,
OcpModelGroupVO
>
groupByCode
=
ocpModelGroupVOList
.
stream
().
collect
(
Collectors
.
toMap
(
OcpModelGroupVO:
:
getModelGroupCode
,
Function
.
identity
(),
(
key1
,
key2
)
->
key2
));
Map
<
String
,
OcpModelGroupVO
>
groupByCode
=
ocpModelGroupVOList
.
stream
().
collect
(
Collectors
.
toMap
(
OcpModelGroupVO:
:
getModelGroupCode
,
Function
.
identity
(),
(
key1
,
key2
)
->
key2
));
//根据key获取前端传入code的对象
OcpModelGroupVO
ocpModelGroupVO
=
groupByCode
.
get
(
parentGroupCode
);
OcpModelGroupVO
ocpModelGroupVO
=
groupByCode
.
get
(
parentGroupCode
);
List
<
OcpModelGroupVO
>
childrenList
=
findChildren
(
ocpModelGroupVOList
,
ocpModelGroupVO
,
new
LinkedList
<>());
//模糊查询
PageHelper
.
startPage
(
currentPage
,
pageSize
);
List
<
OcpModelGroupVO
>
dimConditionList
=
this
.
selectByCondition
(
null
,
subclassGroupName
);
//递归获取模糊查询后属于parentGroupCode子集
List
<
OcpModelGroupVO
>
childrenList
=
findChildren
(
dimConditionList
,
ocpModelGroupVO
,
new
LinkedList
<>());
PageInfo
<
OcpModelGroupVO
>
pageInfo
=
new
PageInfo
<>(
childrenList
);
PageInfo
<
OcpModelGroupVO
>
pageInfo
=
new
PageInfo
<>(
childrenList
);
return
ResponseVO
.
ok
(
pageInfo
);
return
ResponseVO
.
ok
(
pageInfo
);
}
}
...
@@ -109,27 +117,33 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
...
@@ -109,27 +117,33 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
* 获取父节点下的所有子节点放入list中
* 获取父节点下的所有子节点放入list中
* @author huxiuwu
* @author huxiuwu
* @date 2022/3/9
* @date 2022/3/9
* @param
menu
List
* @param
group
List
* @param child
Menu
* @param child
List
* @return void
* @return void
**/
**/
private
List
<
OcpModelGroupVO
>
findChildren
(
List
<
OcpModelGroupVO
>
menuList
,
OcpModelGroupVO
parent
,
List
<
OcpModelGroupVO
>
childMenu
)
{
private
List
<
OcpModelGroupVO
>
findChildren
(
List
<
OcpModelGroupVO
>
groupList
,
OcpModelGroupVO
parent
,
List
<
OcpModelGroupVO
>
childList
)
{
for
(
OcpModelGroupVO
vo
:
menu
List
)
{
for
(
OcpModelGroupVO
vo
:
group
List
)
{
//遍历出父id等于参数的id,add进子节点集合
//遍历出父id等于参数的id,add进子节点集合
if
(
parent
.
getModelGroupCode
()
!=
null
&&
parent
.
getModelGroupCode
().
equals
(
vo
.
getModelGroupPcode
()))
{
if
(
parent
!=
null
&&
parent
.
getModelGroupCode
()
.
equals
(
vo
.
getModelGroupPcode
()))
{
//递归遍历下一级
//递归遍历下一级
vo
.
setModelGroupPName
(
parent
.
getModelGroupName
());
vo
.
setModelGroupPName
(
parent
.
getModelGroupName
());
child
Menu
.
add
(
vo
);
child
List
.
add
(
vo
);
child
Menu
=
findChildren
(
menuList
,
vo
,
childMenu
);
child
List
=
findChildren
(
groupList
,
vo
,
childList
);
}
}
}
}
return
child
Menu
;
return
child
List
;
}
}
/**
/**
* 构建树节点
* 构建树节点
*/
* @author huxiuwu
* @date 2022/3/10
* @param treeNodes 需要构建的list
* @return List<com.pms.ocp.model.vo.OcpModelGroupVO>
**/
private
List
<
OcpModelGroupVO
>
build
(
List
<
OcpModelGroupVO
>
treeNodes
)
{
private
List
<
OcpModelGroupVO
>
build
(
List
<
OcpModelGroupVO
>
treeNodes
)
{
List
<
OcpModelGroupVO
>
result
=
new
ArrayList
<>();
List
<
OcpModelGroupVO
>
result
=
new
ArrayList
<>();
//list转map =>将每个对象的id作为key,自己作为value.
//list转map =>将每个对象的id作为key,自己作为value.
...
@@ -141,9 +155,12 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
...
@@ -141,9 +155,12 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
//得到自己的父类
//得到自己的父类
OcpModelGroupVO
parent
=
nodeMap
.
get
(
node
.
getModelGroupPcode
());
OcpModelGroupVO
parent
=
nodeMap
.
get
(
node
.
getModelGroupPcode
());
if
(
parent
!=
null
&&
!(
node
.
getModelGroupCode
().
equals
(
parent
.
getModelGroupCode
())))
{
if
(
parent
!=
null
&&
!(
node
.
getModelGroupCode
().
equals
(
parent
.
getModelGroupCode
())))
{
//防止每次都new list或者只是使用该对象就new对象浪费内存或者覆盖上一次记录
if
(
parent
.
getChildrenList
()
==
null
)
{
if
(
parent
.
getChildrenList
()
==
null
)
{
parent
.
setChildrenList
(
new
LinkedList
<>());
parent
.
setChildrenList
(
new
LinkedList
<>());
}
}
//说明他有父类其下子类都需要加一级
addLevel
(
node
,
treeNodes
);
parent
.
getChildrenList
().
add
(
node
);
parent
.
getChildrenList
().
add
(
node
);
continue
;
continue
;
}
}
...
@@ -151,12 +168,27 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
...
@@ -151,12 +168,27 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
}
}
return
result
;
return
result
;
}
}
/**
*
* @author huxiuwu
* @date 2022/3/10
* @param parent 父类
* @param treeNodes 需要遍历list
**/
private
void
addLevel
(
OcpModelGroupVO
parent
,
List
<
OcpModelGroupVO
>
treeNodes
)
{
parent
.
setLevel
(
parent
.
getLevel
()+
1
);
for
(
OcpModelGroupVO
treeNode
:
treeNodes
)
{
if
(
treeNode
!=
null
&&
parent
.
getModelGroupCode
().
equals
(
treeNode
.
getModelGroupPcode
())){
addLevel
(
treeNode
,
treeNodes
);
}
}
}
private
List
<
OcpModelGroupVO
>
selectByCondition
(
String
...
searchCondition
)
{
private
List
<
OcpModelGroupVO
>
selectByCondition
(
String
...
searchCondition
)
{
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
[
0
])
.
like
(
StringUtils
.
isNotEmpty
(
searchCondition
[
1
]),
"model_group_name"
,
searchCondition
[
0
]
);
.
like
(
StringUtils
.
isNotEmpty
(
searchCondition
[
1
]),
"model_group_name"
,
searchCondition
[
1
]).
orderBy
(
false
,
false
,
"group_ctime"
);
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