|
@@ -20,7 +20,6 @@ import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
-import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* 前台订单管理Service实现类
|
|
@@ -200,22 +199,38 @@ public class PmsPortalProductServiceImpl implements PmsPortalProductService {
|
|
|
}
|
|
|
return pmsProductCategories;
|
|
|
}
|
|
|
+
|
|
|
private List<ProductCategorySmallVo> getProductCategoryList() {
|
|
|
PmsProductCategoryExample example = new PmsProductCategoryExample();
|
|
|
example.setOrderByClause("sort desc");
|
|
|
- example.createCriteria().andParentIdEqualTo(0L)
|
|
|
+ example.createCriteria()
|
|
|
.andShowStatusEqualTo(1);
|
|
|
List<PmsProductCategory> pmsProductCategories = productCategoryMapper.selectByExample(example);
|
|
|
if (CollectionUtils.isEmpty(pmsProductCategories)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
- return pmsProductCategories.stream()
|
|
|
- .map( pmsProductCategory -> {
|
|
|
- ProductCategorySmallVo productCategorySmallVo = new ProductCategorySmallVo();
|
|
|
- BeanUtils.copyProperties(pmsProductCategory,productCategorySmallVo);
|
|
|
- return productCategorySmallVo;
|
|
|
- })
|
|
|
- .collect(Collectors.toList());
|
|
|
+ List<ProductCategorySmallVo> collect = pmsProductCategories.stream().map(pmsProductCategory -> {
|
|
|
+ ProductCategorySmallVo productCategorySmallVo = new ProductCategorySmallVo();
|
|
|
+ BeanUtils.copyProperties(pmsProductCategory, productCategorySmallVo);
|
|
|
+ return productCategorySmallVo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProductCategorySmallVo> tree = new ArrayList<>();
|
|
|
+ for (ProductCategorySmallVo categorySmallVo : collect) {
|
|
|
+ if (categorySmallVo.getParentId() == null || categorySmallVo.getParentId() == 0) {
|
|
|
+ tree.add(categorySmallVo);
|
|
|
+ }
|
|
|
+ for (ProductCategorySmallVo tagVo : collect) {
|
|
|
+ if (tagVo.getParentId() != null && tagVo.getParentId() != 0 && tagVo.getParentId().equals(categorySmallVo.getId())) {
|
|
|
+ if (categorySmallVo.getChildren() == null) {
|
|
|
+ categorySmallVo.setChildren(new ArrayList<>());
|
|
|
+ }
|
|
|
+ categorySmallVo.getChildren().add(tagVo);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return tree;
|
|
|
}
|
|
|
|
|
|
private List<PmsBrand> getBrandList() {
|