|
@@ -20,6 +20,7 @@ import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 前台订单管理Service实现类
|
|
* 前台订单管理Service实现类
|
|
@@ -63,7 +64,8 @@ public class PmsPortalProductServiceImpl implements PmsPortalProductService {
|
|
criteria.andBrandIdEqualTo(brandId);
|
|
criteria.andBrandIdEqualTo(brandId);
|
|
}
|
|
}
|
|
if (productCategoryId != null) {
|
|
if (productCategoryId != null) {
|
|
- criteria.andProductCategoryIdEqualTo(productCategoryId);
|
|
|
|
|
|
+ List<Long> productCategoryIds = getProductCategoryIds(productCategoryId);
|
|
|
|
+ criteria.andProductCategoryIdIn(productCategoryIds);
|
|
}
|
|
}
|
|
if (productAttributeCategoryId != null) {
|
|
if (productAttributeCategoryId != null) {
|
|
criteria.andProductAttributeCategoryIdEqualTo(productAttributeCategoryId);
|
|
criteria.andProductAttributeCategoryIdEqualTo(productAttributeCategoryId);
|
|
@@ -95,6 +97,29 @@ public class PmsPortalProductServiceImpl implements PmsPortalProductService {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取当前分类和下级分类 id
|
|
|
|
+ *
|
|
|
|
+ * @param productCategoryId
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private List<Long> getProductCategoryIds(Long productCategoryId) {
|
|
|
|
+ PmsProductCategoryExample productCategoryExample = new PmsProductCategoryExample();
|
|
|
|
+ productCategoryExample.setOrderByClause("sort desc");
|
|
|
|
+ productCategoryExample.createCriteria().andParentIdEqualTo(productCategoryId)
|
|
|
|
+ .andShowStatusEqualTo(1);
|
|
|
|
+ List<PmsProductCategory> pmsProductCategories = productCategoryMapper.selectByExample(productCategoryExample);
|
|
|
|
+ List<Long> productCategoryIds = new ArrayList<>();
|
|
|
|
+ if (!CollectionUtils.isEmpty(pmsProductCategories)) {
|
|
|
|
+ productCategoryIds = pmsProductCategories
|
|
|
|
+ .stream()
|
|
|
|
+ .map(PmsProductCategory::getId)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+ productCategoryIds.add(productCategoryId);
|
|
|
|
+ return productCategoryIds;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public List<PmsProductCategoryNode> categoryTreeList() {
|
|
public List<PmsProductCategoryNode> categoryTreeList() {
|
|
PmsProductCategoryExample example = new PmsProductCategoryExample();
|
|
PmsProductCategoryExample example = new PmsProductCategoryExample();
|