【修复】修复后台商品增加扩展分类后,在小程序首页使用商品组件并选择具体分类数据时未获取到的问题。

This commit is contained in:
jianweie code
2023-03-17 23:55:57 +08:00
parent 327fd0e9e6
commit 36577d2bc9

View File

@@ -28,6 +28,7 @@ using Essensoft.Paylink.Alipay.Domain;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using NPOI.SS.Formula.Functions; using NPOI.SS.Formula.Functions;
using Org.BouncyCastle.Crypto;
using SqlSugar; using SqlSugar;
using static NPOI.HSSF.Util.HSSFColor; using static NPOI.HSSF.Util.HSSFColor;
@@ -51,12 +52,13 @@ namespace CoreCms.Net.Services
private readonly ICoreCmsPromotionConditionServices _promotionConditionServices; private readonly ICoreCmsPromotionConditionServices _promotionConditionServices;
private readonly ICoreCmsPinTuanRuleServices _pinTuanRuleServices; private readonly ICoreCmsPinTuanRuleServices _pinTuanRuleServices;
private readonly ICoreCmsServicesServices _servicesServices; private readonly ICoreCmsServicesServices _servicesServices;
private readonly ICoreCmsGoodsCategoryExtendServices _goodsCategoryExtendServices;
private readonly IUnitOfWork _unitOfWork; private readonly IUnitOfWork _unitOfWork;
public CoreCmsPagesServices(IUnitOfWork unitOfWork public CoreCmsPagesServices(IUnitOfWork unitOfWork
, ICoreCmsPagesRepository dal , ICoreCmsPagesRepository dal
, ICoreCmsPagesItemsRepository pagesItemsRepository, ICoreCmsPromotionServices promotionServices, ICoreCmsNoticeServices noticeServices, ICoreCmsGoodsCategoryServices goodsCategoryServices, ICoreCmsSettingServices settingServices, ICoreCmsGoodsServices goodsServices, ICoreCmsArticleServices articleServices, ICoreCmsPromotionConditionServices promotionConditionServices, ICoreCmsPinTuanRuleServices pinTuanRuleServices, ICoreCmsServicesServices servicesServices, ICoreCmsArticleTypeServices articleTypeServices) , ICoreCmsPagesItemsRepository pagesItemsRepository, ICoreCmsPromotionServices promotionServices, ICoreCmsNoticeServices noticeServices, ICoreCmsGoodsCategoryServices goodsCategoryServices, ICoreCmsSettingServices settingServices, ICoreCmsGoodsServices goodsServices, ICoreCmsArticleServices articleServices, ICoreCmsPromotionConditionServices promotionConditionServices, ICoreCmsPinTuanRuleServices pinTuanRuleServices, ICoreCmsServicesServices servicesServices, ICoreCmsArticleTypeServices articleTypeServices, ICoreCmsGoodsCategoryExtendServices goodsCategoryExtendServices)
{ {
this._dal = dal; this._dal = dal;
_pagesItemsRepository = pagesItemsRepository; _pagesItemsRepository = pagesItemsRepository;
@@ -70,6 +72,7 @@ namespace CoreCms.Net.Services
_pinTuanRuleServices = pinTuanRuleServices; _pinTuanRuleServices = pinTuanRuleServices;
_servicesServices = servicesServices; _servicesServices = servicesServices;
_articleTypeServices = articleTypeServices; _articleTypeServices = articleTypeServices;
_goodsCategoryExtendServices = goodsCategoryExtendServices;
base.BaseDal = dal; base.BaseDal = dal;
_unitOfWork = unitOfWork; _unitOfWork = unitOfWork;
} }
@@ -382,7 +385,22 @@ namespace CoreCms.Net.Services
: new List<int>(); : new List<int>();
catIds.Add(classifyId); catIds.Add(classifyId);
//where = where.And(p => catIds.Contains(p.goodsCategoryId));
//扩展分类
var extends = await _goodsCategoryExtendServices.QueryListByClauseAsync(p => p.goodsCategroyId == classifyId);
if (extends.Any())
{
var extGoodIds = extends.Select(p => p.goodsId).ToList();
where = where.And(p => catIds.Contains(p.goodsCategoryId) || extGoodIds.Contains(p.id));
}
else
{
where = where.And(p => catIds.Contains(p.goodsCategoryId)); where = where.And(p => catIds.Contains(p.goodsCategoryId));
}
//扩展分类 CoreCmsGoodsCategory //扩展分类 CoreCmsGoodsCategory
} }
//品牌筛选 //品牌筛选