搜索优化,问题:如果搜索没有指定分类id,业务代码回查询所有到栏目ID然后传递给find_in_set函数,性能有问题、oracle函数定义变量长度也会存在问题。解决:去掉查询所有的分类id
This commit is contained in:
parent
076b14704d
commit
2b83e417b7
|
@ -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, ",");
|
||||
|
||||
|
||||
//根据栏目确定自定义模型
|
||||
|
|
Loading…
Reference in New Issue