Commit 9f68db8d authored by 赵啸非's avatar 赵啸非

修改产品分类与公司查询

parent b801cf94
......@@ -112,7 +112,7 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
List<ProductEntity> productList = productCategoryResult.getList().stream().map(item -> {
ProductEntity productEntity = this.getCache(item.getProductId().toString());
if (!ObjectUtils.isEmpty(productEntity)) {
String companyIds = companyProductService.find(new CompanyProductQuery().productId(productEntity.getId())).stream().map(i -> i.getProductId().toString()).collect(Collectors.joining(","));
String companyIds = companyProductService.find(new CompanyProductQuery().productId(productEntity.getId())).stream().map(i -> i.getCompanyId().toString()).collect(Collectors.joining(","));
productEntity.setCompanyId(companyIds);
productEntity.setCategoryId(entity.getCategoryId());
}
......@@ -124,29 +124,12 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
@Override
protected void findAfter(ProductEntity params, PageInfo pageInfo, Context context, List<ProductEntity> list) throws AppException {
list.forEach(item -> {
String categoryIds = productCategoryService.find(new ProductCategoryQuery().productId(item.getId())).stream().map(i -> i.getCategoryId().toString()).collect(Collectors.joining(","));
String companyIds = companyProductService.find(new CompanyProductQuery().productId(item.getId())).stream().map(i -> i.getProductId().toString()).collect(Collectors.joining(","));
String categoryIds = productCategoryService.find(new ProductCategoryQuery().productId(item.getId())).stream().map(i -> i.getCategoryId().toString()).distinct().collect(Collectors.joining(","));
String companyIds = companyProductService.find(new CompanyProductQuery().productId(item.getId())).stream().map(i -> i.getCompanyId().toString()).distinct().collect(Collectors.joining(","));
item.setCompanyId(companyIds);
item.setCategoryId(categoryIds);
});
if (!ObjectUtils.isEmpty(params.getCategoryId())) {
//种类不为空 删除掉空的
Iterator<ProductEntity> iterator = list.iterator();
while (iterator.hasNext()) {
ProductEntity product = iterator.next();
String categoryIds = productCategoryService.find(new ProductCategoryQuery().productId(product.getId())).stream().map(i -> i.getCategoryId().toString()).collect(Collectors.joining(","));
}
}
if (!ObjectUtils.isEmpty(params.getCompanyId())) {
//公司查询不为空
}
}
@Override
......
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