|
|
@ -5,6 +5,7 @@ |
|
|
|
*/ |
|
|
|
package com.shop.cereshop.admin.service.product.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
@ -245,7 +246,7 @@ public class CereProductClassifyServiceImpl implements CereProductClassifyServic |
|
|
|
secondClassify.initMap(cereProductClassifyLangInfoList); |
|
|
|
secondClassify.initData(); |
|
|
|
if(CollectionUtils.isNotEmpty(secondClassify.getChilds())) { |
|
|
|
for (CereProductClassify thirdClassify : classify.getChilds()) { |
|
|
|
for (CereProductClassify thirdClassify : secondClassify.getChilds()) { |
|
|
|
thirdClassify.initMap(cereProductClassifyLangInfoList); |
|
|
|
thirdClassify.initData(); |
|
|
|
} |
|
|
@ -263,7 +264,7 @@ public class CereProductClassifyServiceImpl implements CereProductClassifyServic |
|
|
|
PageHelper.startPage(param.getPage(),param.getPageSize()); |
|
|
|
List<CereProductClassify> list=cereProductClassifyDAO.getAll(); |
|
|
|
|
|
|
|
List<Long> classifyIdList = new ArrayList<>(); |
|
|
|
/* List<Long> classifyIdList = new ArrayList<>(); |
|
|
|
classifyIdList.addAll(list.stream().map(CereProductClassify::getClassifyId).collect(Collectors.toList())); |
|
|
|
classifyIdList = classifyIdList.stream().filter(item -> item != null && item > 0).distinct().collect(Collectors.toList()); |
|
|
|
|
|
|
@ -276,6 +277,44 @@ public class CereProductClassifyServiceImpl implements CereProductClassifyServic |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
for (CereProductClassify classify : list) { |
|
|
|
List<Long> classifyIdList = new ArrayList<>(); |
|
|
|
classifyIdList.add(classify.getClassifyId()); |
|
|
|
//查询所有二级分类 |
|
|
|
List<CereProductClassify> classifies=cereProductClassifyDAO.findByPid(classify.getClassifyId()); |
|
|
|
if (ObjectUtil.isNotEmpty(classifies)){ |
|
|
|
classifyIdList.addAll(classifies.stream().map(CereProductClassify::getClassifyId).collect(Collectors.toList())); |
|
|
|
for (CereProductClassify a : classifies) { |
|
|
|
//查询所有三级分类 |
|
|
|
a.setChilds(cereProductClassifyDAO.findByPid(a.getClassifyId())); |
|
|
|
classifyIdList.addAll(a.getChilds().stream().map(CereProductClassify::getClassifyId).collect(Collectors.toList())); |
|
|
|
} |
|
|
|
classify.setChilds(classifies); |
|
|
|
} |
|
|
|
|
|
|
|
if(ObjectUtil.isNotEmpty(classifyIdList)) { |
|
|
|
classifyIdList = classifyIdList.stream().filter(item -> item != null && item > 0).distinct().collect(Collectors.toList()); |
|
|
|
List<CereProductClassifyLangInfo> cereProductClassifyLangInfoList = cereProductClassifyLangInfoService.list(Wrappers.<CereProductClassifyLangInfo>lambdaQuery().in(CereProductClassifyLangInfo::getClassifyId, classifyIdList)); |
|
|
|
if (ObjectUtil.isNotEmpty(classify)) { |
|
|
|
classify.initMap(cereProductClassifyLangInfoList); |
|
|
|
classify.initData(); |
|
|
|
if(CollectionUtils.isNotEmpty(classify.getChilds())) { |
|
|
|
for (CereProductClassify secondClassify : classify.getChilds()) { |
|
|
|
secondClassify.initMap(cereProductClassifyLangInfoList); |
|
|
|
secondClassify.initData(); |
|
|
|
if(CollectionUtils.isNotEmpty(secondClassify.getChilds())) { |
|
|
|
for (CereProductClassify thirdClassify : secondClassify.getChilds()) { |
|
|
|
thirdClassify.initMap(cereProductClassifyLangInfoList); |
|
|
|
thirdClassify.initData(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
PageInfo<CereProductClassify> pageInfo=new PageInfo<>(list); |
|
|
|
Page page=new Page(pageInfo.getList(),pageInfo.getTotal()); |
|
|
|