Commit 2b83e417 authored by msgroup's avatar msgroup

搜索优化,问题:如果搜索没有指定分类id,业务代码回查询所有到栏目ID然后传递给find_in_set函数,性能有问题、oracle函数定义变量长度也会存在问题。解决:去掉查询所有的分类id

parent 076b1470
......@@ -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, ",");
//根据栏目确定自定义模型
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment