Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
MCMS
Commits
2b83e417
Commit
2b83e417
authored
Feb 23, 2021
by
msgroup
Browse files
搜索优化,问题:如果搜索没有指定分类id,业务代码回查询所有到栏目ID然后传递给find_in_set函数,性能有问题、oracle函数定义变量长度也会存在问题。解决:去掉查询所有的分类id
parent
076b1470
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/net/mingsoft/cms/action/web/MCmsAction.java
View file @
2b83e417
...
...
@@ -347,30 +347,33 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
//获取栏目信息
String
typeId
=
null
;
String
categoryIds
=
BasicUtil
.
getString
(
"categoryIds"
);
List
categoryIdList
=
CollectionUtil
.
newArrayList
();
//List categoryIdList = CollectionUtil.newArrayList();
//当传递了栏目编号,但不是栏目集合
if
(
StringUtils
.
isNotBlank
(
categoryIds
)
&&
!
categoryIds
.
contains
(
","
))
{
typeId
=
categoryIds
;
}
else
{
//取出所有的子栏目
String
[]
ids
=
categoryIds
.
split
(
","
);
List
<
CategoryEntity
>
categoryList
=
categoryBiz
.
list
(
Wrappers
.<
CategoryEntity
>
lambdaQuery
().
ne
(
CategoryEntity:
:
getCategoryType
,
CategoryTypeEnum
.
LINK
.
toString
()));
categoryIdList
=
CollectionUtil
.
newArrayList
(
ids
);
for
(
CategoryEntity
c:
categoryList
)
{
if
(
StringUtils
.
isNotEmpty
(
c
.
getParentids
()))
{
for
(
String
id:
ids
)
{
if
(
c
.
getParentids
().
indexOf
(
id
)>-
1
)
{
categoryIdList
.
add
(
c
.
getId
());
break
;
}
}
}
}
}
// else {
// //取出所有的子栏目
// String[] ids = categoryIds.split(",");
// List<CategoryEntity> categoryList = categoryBiz.list(Wrappers.<CategoryEntity>lambdaQuery().ne(CategoryEntity::getCategoryType, CategoryTypeEnum.LINK.toString()));
//
// categoryIdList = CollectionUtil.newArrayList(ids);
// for(CategoryEntity c:categoryList) {
// if(StringUtils.isNotEmpty(c.getParentids())) {
// for(String id:ids) {
// if(c.getParentids().indexOf(id)>-1) {
// categoryIdList.add(c.getId());
// break;
// }
// }
// }
// }
// }
//重新组织 ID
categoryIds
=
StringUtils
.
join
(
categoryIdList
,
","
);
//
categoryIds = StringUtils.join(categoryIdList, ",");
//根据栏目确定自定义模型
...
...
Write
Preview
Supports
Markdown
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