【修复】修复后台商品增加扩展分类后,在后台商品列表筛选未获取到的问题。

This commit is contained in:
jianweie code
2023-03-17 00:47:51 +08:00
parent 1ddde99dd1
commit 327fd0e9e6
2 changed files with 15 additions and 3 deletions

View File

@@ -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));
}
}

View File

@@ -1846,7 +1846,7 @@
商品表
</summary>
</member>
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsGoodsController.#ctor(Microsoft.AspNetCore.Hosting.IWebHostEnvironment,CoreCms.Net.IServices.ICoreCmsGoodsServices,CoreCms.Net.IServices.ICoreCmsSettingServices,CoreCms.Net.IServices.ICoreCmsBrandServices,CoreCms.Net.IServices.ICoreCmsGoodsCategoryServices,CoreCms.Net.IServices.ICoreCmsUserGradeServices,CoreCms.Net.IServices.ICoreCmsGoodsParamsServices,CoreCms.Net.IServices.ICoreCmsGoodsTypeSpecValueServices,CoreCms.Net.IServices.ICoreCmsGoodsGradeServices,CoreCms.Net.IServices.ICoreCmsProductsServices,CoreCms.Net.IServices.ICoreCmsGoodsCategoryExtendServices,CoreCms.Net.IServices.ICoreCmsLabelServices,CoreCms.Net.IServices.ICoreCmsProductsDistributionServices,CoreCms.Net.IServices.ICoreCmsGoodsTypeSpecServices,CoreCms.Net.Caching.AutoMate.RedisCache.IRedisOperationRepository)">
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsGoodsController.#ctor(Microsoft.AspNetCore.Hosting.IWebHostEnvironment,CoreCms.Net.IServices.ICoreCmsGoodsServices,CoreCms.Net.IServices.ICoreCmsSettingServices,CoreCms.Net.IServices.ICoreCmsBrandServices,CoreCms.Net.IServices.ICoreCmsGoodsCategoryServices,CoreCms.Net.IServices.ICoreCmsUserGradeServices,CoreCms.Net.IServices.ICoreCmsGoodsParamsServices,CoreCms.Net.IServices.ICoreCmsGoodsTypeSpecValueServices,CoreCms.Net.IServices.ICoreCmsGoodsGradeServices,CoreCms.Net.IServices.ICoreCmsProductsServices,CoreCms.Net.IServices.ICoreCmsGoodsCategoryExtendServices,CoreCms.Net.IServices.ICoreCmsLabelServices,CoreCms.Net.IServices.ICoreCmsProductsDistributionServices,CoreCms.Net.IServices.ICoreCmsGoodsTypeSpecServices,CoreCms.Net.Caching.AutoMate.RedisCache.IRedisOperationRepository,CoreCms.Net.IServices.ICoreCmsGoodsCategoryExtendServices)">
<summary>
构造函数
</summary>