Commit a1a99c0d by huluobin

update

parent 4c802a0d
......@@ -3,7 +3,6 @@ package com.gogirl.application.product.mall.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gogirl.application.product.mall.MallCategoryService;
import com.gogirl.domain.product.mall.MallCategory;
import com.gogirl.infrastructure.common.util.ListUtil;
import com.gogirl.infrastructure.mapper.order.mall.CategoryMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
......@@ -25,7 +24,9 @@ public class MallCategoryServiceImpl extends ServiceImpl<CategoryMapper, MallCat
@Override
public List<MallCategory> getCategoryList(Long categoryId) {
List<MallCategory> list = this.getCategoryTreeList();
return findSubTree(list, categoryId);
List<MallCategory> result = new ArrayList<>();
findSubTree(list, categoryId, result);
return result;
}
/**
......@@ -34,19 +35,17 @@ public class MallCategoryServiceImpl extends ServiceImpl<CategoryMapper, MallCat
* @param list
* @param subTreeId
*/
private List<MallCategory> findSubTree(List<MallCategory> list, Long subTreeId) {
private void findSubTree(List<MallCategory> list, Long subTreeId, List<MallCategory> result) {
for (MallCategory mallCategory : list) {
if (mallCategory.getChildList() == null) {
mallCategory.setChildList(new ArrayList<>());
}
if (mallCategory.getId().equals(subTreeId)) {
if (ListUtil.isEmpty(mallCategory.getChildList())) {
return new ArrayList<>();
}
return mallCategory.getChildList();
} else if (ListUtil.isNotEmpty(mallCategory.getChildList())) {
this.findSubTree(mallCategory.getChildList(), subTreeId);
result.addAll(mallCategory.getChildList());
}
findSubTree(mallCategory.getChildList(), subTreeId, result);
}
return new ArrayList<>();
}
/**
......
spring:
profiles:
active: prod
active: pre
servlet:
#文件上传最大容量
multipart:
......
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