mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 17:43:26 +08:00
【修复】修复后台商品增加扩展分类后,在后台商品列表筛选未获取到的问题。
This commit is contained in:
@@ -60,6 +60,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
private readonly ICoreCmsProductsDistributionServices _productsDistributionServices;
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly IRedisOperationRepository _redisOperationRepository;
|
||||
private readonly ICoreCmsGoodsCategoryExtendServices _goodsCategoryExtendServices;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -78,7 +79,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
, ICoreCmsGoodsCategoryExtendServices categoryExtendServices
|
||||
, ICoreCmsLabelServices labelServices
|
||||
, ICoreCmsProductsDistributionServices productsDistributionServices
|
||||
, ICoreCmsGoodsTypeSpecServices goodsTypeSpecServices, IRedisOperationRepository redisOperationRepository)
|
||||
, ICoreCmsGoodsTypeSpecServices goodsTypeSpecServices, IRedisOperationRepository redisOperationRepository, ICoreCmsGoodsCategoryExtendServices goodsCategoryExtendServices)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_coreCmsGoodsServices = coreCmsGoodsServices;
|
||||
@@ -95,6 +96,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
_productsDistributionServices = productsDistributionServices;
|
||||
_goodsTypeSpecServices = goodsTypeSpecServices;
|
||||
_redisOperationRepository = redisOperationRepository;
|
||||
_goodsCategoryExtendServices = goodsCategoryExtendServices;
|
||||
}
|
||||
|
||||
#region 获取列表============================================================
|
||||
@@ -183,7 +185,17 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
var categories = await _coreCmsGoodsCategoryServices.QueryAsync(true, true);
|
||||
var ids = GoodsHelper.GetChildIds(categories, goodsCategoryId);
|
||||
|
||||
@where = @where.And(p => ids.Contains(p.goodsCategoryId));
|
||||
//扩展分类
|
||||
var extends = await _goodsCategoryExtendServices.QueryListByClauseAsync(p => p.goodsCategroyId == goodsCategoryId);
|
||||
if (extends.Any())
|
||||
{
|
||||
var extGoodIds = extends.Select(p => p.goodsId).ToList();
|
||||
where = where.And(p => ids.Contains(p.goodsCategoryId) || extGoodIds.Contains(p.id));
|
||||
}
|
||||
else
|
||||
{
|
||||
where = where.And(p => ids.Contains(p.goodsCategoryId));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user