Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
cms_sys
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
西魏
cms_sys
Commits
2b83e417
Commit
2b83e417
authored
Feb 23, 2021
by
msgroup
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
搜索优化,问题:如果搜索没有指定分类id,业务代码回查询所有到栏目ID然后传递给find_in_set函数,性能有问题、oracle函数定义变量长度也会存在问题。解决:去掉查询所有的分类id
parent
076b1470
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
18 deletions
+21
-18
MCmsAction.java
src/main/java/net/mingsoft/cms/action/web/MCmsAction.java
+21
-18
No files found.
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
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