mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 18:43:26 +08:00
【新增】增加商品列表dto类及查询方法,首页【商品组件】【商品tab组】【仿点餐界面】【栏目列表页】【推荐商品列表】进行替换。
【优化】优化普通商品及营销商品内页不同dom之间间距。微调其他页面样式 【调整】移除.net5升级到.net6保留的startup.cs文件,使用program.cs
This commit is contained in:
@@ -13,6 +13,7 @@ using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.DTO.ComponentsDTO;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Loging;
|
||||
@@ -278,6 +279,8 @@ namespace CoreCms.Net.Repository
|
||||
}
|
||||
}
|
||||
}
|
||||
//删除dto缓存
|
||||
DbClient.DataCache.RemoveDataCache(nameof(GoodListDTO));
|
||||
|
||||
jm.data = entity;
|
||||
jm.code = bl ? 0 : 1;
|
||||
@@ -733,6 +736,10 @@ namespace CoreCms.Net.Repository
|
||||
}
|
||||
}
|
||||
//事物处理过程结束
|
||||
|
||||
//删除dto缓存
|
||||
DbClient.DataCache.RemoveDataCache(nameof(GoodListDTO));
|
||||
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
|
||||
@@ -756,6 +763,12 @@ namespace CoreCms.Net.Repository
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
|
||||
if (bl)
|
||||
{
|
||||
//删除dto缓存
|
||||
DbClient.DataCache.RemoveDataCache(nameof(GoodListDTO));
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
@@ -882,54 +895,41 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="number"></param>
|
||||
/// <param name="isRecommend"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsGoods>> GetGoodsRecommendList(int number, bool isRecommend = false)
|
||||
public async Task<List<GoodListDTO>> GetGoodsRecommendList(int number, bool isRecommend = false)
|
||||
{
|
||||
var list = new List<CoreCmsGoods>();
|
||||
var list = new List<GoodListDTO>();
|
||||
|
||||
if (isRecommend)
|
||||
{
|
||||
list = await DbClient.Queryable<CoreCmsGoods, CoreCmsProducts>((good, pd) => new JoinQueryInfos(
|
||||
JoinType.Left, good.id == pd.goodsId))
|
||||
.Where((good, pd) => pd.isDefalut == true && pd.isDel == false && good.isRecommend == true && good.isDel == false && good.isMarketable == true)
|
||||
.Select((good, pd) => new CoreCmsGoods
|
||||
.Select((good, pd) => new GoodListDTO()
|
||||
{
|
||||
id = good.id,
|
||||
bn = good.bn,
|
||||
name = good.name,
|
||||
brief = good.brief,
|
||||
image = good.image,
|
||||
images = good.images,
|
||||
image = !SqlFunc.IsNullOrEmpty(good.image) ? good.image : EmptyOrNullImagePath.GoodImage,
|
||||
video = good.video,
|
||||
productsDistributionType = good.productsDistributionType,
|
||||
goodsCategoryId = good.goodsCategoryId,
|
||||
goodsTypeId = good.goodsTypeId,
|
||||
brandId = good.brandId,
|
||||
isNomalVirtual = good.isNomalVirtual,
|
||||
isMarketable = good.isMarketable,
|
||||
unit = good.unit,
|
||||
//intro = good.intro,
|
||||
spesDesc = good.spesDesc,
|
||||
parameters = good.parameters,
|
||||
commentsCount = good.commentsCount,
|
||||
viewCount = good.viewCount,
|
||||
buyCount = good.buyCount,
|
||||
uptime = good.uptime,
|
||||
downtime = good.downtime,
|
||||
buyCount = SqlFunc.Subqueryable<CoreCmsOrderItem>()
|
||||
.LeftJoin<CoreCmsOrder>((sOrderItem, sOrder) => sOrder.orderId == sOrderItem.orderId)
|
||||
.Where((sOrderItem, sOrder) => sOrderItem.goodsId == good.id && (sOrder.payStatus == (int)GlobalEnumVars.OrderPayStatus.Yes || sOrder.payStatus == (int)GlobalEnumVars.OrderPayStatus.PartialYes))
|
||||
.Sum(p => p.nums),
|
||||
sort = good.sort,
|
||||
labelIds = good.labelIds,
|
||||
newSpec = good.newSpec,
|
||||
openSpec = good.openSpec,
|
||||
createTime = good.createTime,
|
||||
updateTime = good.updateTime,
|
||||
isRecommend = good.isRecommend,
|
||||
isHot = good.isHot,
|
||||
isDel = good.isDel,
|
||||
sn = pd.sn,
|
||||
price = pd.price,
|
||||
costprice = pd.costprice,
|
||||
mktprice = pd.mktprice,
|
||||
stock = pd.stock,
|
||||
freezeStock = pd.freezeStock,
|
||||
pointsDeduction = pd.pointsDeduction,
|
||||
points = pd.points,
|
||||
weight = pd.weight,
|
||||
@@ -955,46 +955,33 @@ namespace CoreCms.Net.Repository
|
||||
{
|
||||
list = await DbClient.Queryable<CoreCmsGoods, CoreCmsProducts>((good, pd) => new JoinQueryInfos(
|
||||
JoinType.Left, good.id == pd.goodsId))
|
||||
.Where((good, pd) => pd.isDefalut == true && pd.isDel == false)
|
||||
.Select((good, pd) => new CoreCmsGoods
|
||||
.Where((good, pd) => pd.isDefalut == true && pd.isDel == false && good.isRecommend == true && good.isDel == false && good.isMarketable == true)
|
||||
.Select((good, pd) => new GoodListDTO
|
||||
{
|
||||
id = good.id,
|
||||
bn = good.bn,
|
||||
name = good.name,
|
||||
brief = good.brief,
|
||||
image = good.image,
|
||||
images = good.images,
|
||||
image = !SqlFunc.IsNullOrEmpty(good.image) ? good.image : EmptyOrNullImagePath.GoodImage,
|
||||
video = good.video,
|
||||
productsDistributionType = good.productsDistributionType,
|
||||
goodsCategoryId = good.goodsCategoryId,
|
||||
goodsTypeId = good.goodsTypeId,
|
||||
brandId = good.brandId,
|
||||
isNomalVirtual = good.isNomalVirtual,
|
||||
isMarketable = good.isMarketable,
|
||||
unit = good.unit,
|
||||
//intro = good.intro,
|
||||
spesDesc = good.spesDesc,
|
||||
parameters = good.parameters,
|
||||
commentsCount = good.commentsCount,
|
||||
viewCount = good.viewCount,
|
||||
buyCount = good.buyCount,
|
||||
uptime = good.uptime,
|
||||
downtime = good.downtime,
|
||||
buyCount = SqlFunc.Subqueryable<CoreCmsOrderItem>()
|
||||
.LeftJoin<CoreCmsOrder>((sOrderItem, sOrder) => sOrder.orderId == sOrderItem.orderId)
|
||||
.Where((sOrderItem, sOrder) => sOrderItem.goodsId == good.id && (sOrder.payStatus == (int)GlobalEnumVars.OrderPayStatus.Yes || sOrder.payStatus == (int)GlobalEnumVars.OrderPayStatus.PartialYes))
|
||||
.Sum(p => p.nums),
|
||||
sort = good.sort,
|
||||
labelIds = good.labelIds,
|
||||
newSpec = good.newSpec,
|
||||
openSpec = good.openSpec,
|
||||
createTime = good.createTime,
|
||||
updateTime = good.updateTime,
|
||||
isRecommend = good.isRecommend,
|
||||
isHot = good.isHot,
|
||||
isDel = good.isDel,
|
||||
sn = pd.sn,
|
||||
price = pd.price,
|
||||
costprice = pd.costprice,
|
||||
mktprice = pd.mktprice,
|
||||
stock = pd.stock,
|
||||
freezeStock = pd.freezeStock,
|
||||
pointsDeduction = pd.pointsDeduction,
|
||||
points = pd.points,
|
||||
weight = pd.weight,
|
||||
@@ -1655,6 +1642,113 @@ namespace CoreCms.Net.Repository
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 重写根据条件及自定义排序查询分页数据(返回DTO)
|
||||
/// <summary>
|
||||
/// 重写根据条件及自定义排序查询分页数据(返回DTO)
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <param name="orderBy"></param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public async Task<IPageList<GoodListDTO>> QueryPageByDTOAsync(Expression<Func<GoodListDTO, bool>> predicate, string orderBy = "",
|
||||
int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
List<GoodListDTO> page;
|
||||
if (blUseNoLock)
|
||||
{
|
||||
page = await DbClient.Queryable<CoreCmsGoods, CoreCmsProducts>((good, pd) => new JoinQueryInfos(
|
||||
JoinType.Left, good.id == pd.goodsId))
|
||||
.Where((good, pd) => pd.isDefalut == true && pd.isDel == false && good.isMarketable == true && good.isDel == false)
|
||||
.Select((good, pd) => new GoodListDTO
|
||||
{
|
||||
id = good.id,
|
||||
name = good.name,
|
||||
brief = good.brief,
|
||||
image = !SqlFunc.IsNullOrEmpty(good.image) ? good.image : EmptyOrNullImagePath.GoodImage,
|
||||
video = good.video,
|
||||
goodsCategoryId = good.goodsCategoryId,
|
||||
goodsTypeId = good.goodsTypeId,
|
||||
brandId = good.brandId,
|
||||
isNomalVirtual = good.isNomalVirtual,
|
||||
unit = good.unit,
|
||||
commentsCount = good.commentsCount,
|
||||
viewCount = good.viewCount,
|
||||
buyCount = SqlFunc.Subqueryable<CoreCmsOrderItem>()
|
||||
.LeftJoin<CoreCmsOrder>((sOrderItem, sOrder) => sOrder.orderId == sOrderItem.orderId)
|
||||
.Where((sOrderItem, sOrder) => sOrderItem.goodsId == good.id && (sOrder.payStatus == (int)GlobalEnumVars.OrderPayStatus.Yes || sOrder.payStatus == (int)GlobalEnumVars.OrderPayStatus.PartialYes))
|
||||
.Sum(p => p.nums),
|
||||
sort = good.sort,
|
||||
labelIds = good.labelIds,
|
||||
createTime = good.createTime,
|
||||
isRecommend = good.isRecommend,
|
||||
isHot = good.isHot,
|
||||
price = pd.price,
|
||||
mktprice = pd.mktprice,
|
||||
stock = pd.stock,
|
||||
pointsDeduction = pd.pointsDeduction,
|
||||
points = pd.points,
|
||||
weight = pd.weight,
|
||||
initialSales = good.initialSales,
|
||||
})
|
||||
.With(SqlWith.NoLock)
|
||||
.MergeTable()
|
||||
.Where(predicate)
|
||||
.OrderBy(orderBy)
|
||||
.ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
page = await DbClient.Queryable<CoreCmsGoods, CoreCmsProducts>((good, pd) => new JoinQueryInfos(
|
||||
JoinType.Left, good.id == pd.goodsId))
|
||||
.Where((good, pd) => pd.isDefalut == true && pd.isDel == false && good.isMarketable == true && good.isDel == false)
|
||||
.Select((good, pd) => new GoodListDTO
|
||||
{
|
||||
id = good.id,
|
||||
name = good.name,
|
||||
brief = good.brief,
|
||||
image = !SqlFunc.IsNullOrEmpty(good.image) ? good.image : EmptyOrNullImagePath.GoodImage,
|
||||
video = good.video,
|
||||
goodsCategoryId = good.goodsCategoryId,
|
||||
goodsTypeId = good.goodsTypeId,
|
||||
brandId = good.brandId,
|
||||
isNomalVirtual = good.isNomalVirtual,
|
||||
unit = good.unit,
|
||||
commentsCount = good.commentsCount,
|
||||
viewCount = good.viewCount,
|
||||
buyCount = SqlFunc.Subqueryable<CoreCmsOrderItem>()
|
||||
.LeftJoin<CoreCmsOrder>((sOrderItem, sOrder) => sOrder.orderId == sOrderItem.orderId)
|
||||
.Where((sOrderItem, sOrder) => sOrderItem.goodsId == good.id && (sOrder.payStatus == (int)GlobalEnumVars.OrderPayStatus.Yes || sOrder.payStatus == (int)GlobalEnumVars.OrderPayStatus.PartialYes))
|
||||
.Sum(p => p.nums),
|
||||
sort = good.sort,
|
||||
labelIds = good.labelIds,
|
||||
createTime = good.createTime,
|
||||
isRecommend = good.isRecommend,
|
||||
isHot = good.isHot,
|
||||
price = pd.price,
|
||||
mktprice = pd.mktprice,
|
||||
stock = pd.stock,
|
||||
pointsDeduction = pd.pointsDeduction,
|
||||
points = pd.points,
|
||||
weight = pd.weight,
|
||||
initialSales = good.initialSales,
|
||||
})
|
||||
.MergeTable()
|
||||
.Where(predicate)
|
||||
.OrderBy(orderBy)
|
||||
.ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
}
|
||||
var list = new PageList<GoodListDTO>(page, pageIndex, pageSize, totalCount);
|
||||
return list;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 根据条件查询代理池商品分页数据
|
||||
@@ -2056,5 +2150,219 @@ namespace CoreCms.Net.Repository
|
||||
|
||||
#endregion
|
||||
|
||||
#region 根据条件查询一定数量数据(用于组件)
|
||||
|
||||
/// <summary>
|
||||
/// 根据条件查询一定数量数据(用于组件)
|
||||
/// </summary>
|
||||
/// <param name="predicate">条件表达式树</param>
|
||||
/// <param name="take">获取数量</param>
|
||||
/// <param name="orderByPredicate">排序字段</param>
|
||||
/// <param name="orderByType">排序顺序</param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <param name="isDataCache">是否缓存</param>
|
||||
/// <param name="cacheTimes">缓存时间(分钟)</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<GoodListDTO>> QueryListByComponentsAsync(Expression<Func<GoodListDTO, bool>> predicate, int take,
|
||||
Expression<Func<GoodListDTO, object>> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||
{
|
||||
List<GoodListDTO> page;
|
||||
if (blUseNoLock)
|
||||
{
|
||||
page = await DbClient.Queryable<CoreCmsGoods, CoreCmsProducts>((good, pd) => new JoinQueryInfos(
|
||||
JoinType.Left, good.id == pd.goodsId))
|
||||
.Where((good, pd) => pd.isDefalut == true && pd.isDel == false && good.isMarketable == true && good.isDel == false)
|
||||
.Select((good, pd) => new GoodListDTO
|
||||
{
|
||||
id = good.id,
|
||||
name = good.name,
|
||||
brief = good.brief,
|
||||
image = !SqlFunc.IsNullOrEmpty(good.image) ? good.image : EmptyOrNullImagePath.GoodImage,
|
||||
video = good.video,
|
||||
goodsCategoryId = good.goodsCategoryId,
|
||||
goodsTypeId = good.goodsTypeId,
|
||||
brandId = good.brandId,
|
||||
isNomalVirtual = good.isNomalVirtual,
|
||||
unit = good.unit,
|
||||
commentsCount = good.commentsCount,
|
||||
viewCount = good.viewCount,
|
||||
buyCount = SqlFunc.Subqueryable<CoreCmsOrderItem>()
|
||||
.LeftJoin<CoreCmsOrder>((sOrderItem, sOrder) => sOrder.orderId == sOrderItem.orderId)
|
||||
.Where((sOrderItem, sOrder) => sOrderItem.goodsId == good.id && (sOrder.payStatus == (int)GlobalEnumVars.OrderPayStatus.Yes || sOrder.payStatus == (int)GlobalEnumVars.OrderPayStatus.PartialYes))
|
||||
.Sum(p => p.nums),
|
||||
sort = good.sort,
|
||||
labelIds = good.labelIds,
|
||||
createTime = good.createTime,
|
||||
isRecommend = good.isRecommend,
|
||||
isHot = good.isHot,
|
||||
price = pd.price,
|
||||
mktprice = pd.mktprice,
|
||||
stock = pd.stock,
|
||||
pointsDeduction = pd.pointsDeduction,
|
||||
points = pd.points,
|
||||
weight = pd.weight,
|
||||
initialSales = good.initialSales,
|
||||
})
|
||||
.With(SqlWith.NoLock)
|
||||
.MergeTable()
|
||||
.WhereIF(predicate != null, predicate)
|
||||
.OrderByIF(orderByPredicate != null, orderByPredicate, orderByType)
|
||||
.Take(take)
|
||||
.WithCacheIF(isDataCache, cacheTimes)
|
||||
.ToListAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
page = await DbClient.Queryable<CoreCmsGoods, CoreCmsProducts>((good, pd) => new JoinQueryInfos(
|
||||
JoinType.Left, good.id == pd.goodsId))
|
||||
.Where((good, pd) => pd.isDefalut == true && pd.isDel == false && good.isMarketable == true && good.isDel == false)
|
||||
.Select((good, pd) => new GoodListDTO
|
||||
{
|
||||
id = good.id,
|
||||
name = good.name,
|
||||
brief = good.brief,
|
||||
image = !SqlFunc.IsNullOrEmpty(good.image) ? good.image : EmptyOrNullImagePath.GoodImage,
|
||||
video = good.video,
|
||||
goodsCategoryId = good.goodsCategoryId,
|
||||
goodsTypeId = good.goodsTypeId,
|
||||
brandId = good.brandId,
|
||||
isNomalVirtual = good.isNomalVirtual,
|
||||
unit = good.unit,
|
||||
commentsCount = good.commentsCount,
|
||||
viewCount = good.viewCount,
|
||||
buyCount = SqlFunc.Subqueryable<CoreCmsOrderItem>()
|
||||
.LeftJoin<CoreCmsOrder>((sOrderItem, sOrder) => sOrder.orderId == sOrderItem.orderId)
|
||||
.Where((sOrderItem, sOrder) => sOrderItem.goodsId == good.id && (sOrder.payStatus == (int)GlobalEnumVars.OrderPayStatus.Yes || sOrder.payStatus == (int)GlobalEnumVars.OrderPayStatus.PartialYes))
|
||||
.Sum(p => p.nums),
|
||||
sort = good.sort,
|
||||
labelIds = good.labelIds,
|
||||
createTime = good.createTime,
|
||||
isRecommend = good.isRecommend,
|
||||
isHot = good.isHot,
|
||||
price = pd.price,
|
||||
mktprice = pd.mktprice,
|
||||
stock = pd.stock,
|
||||
pointsDeduction = pd.pointsDeduction,
|
||||
points = pd.points,
|
||||
weight = pd.weight,
|
||||
initialSales = good.initialSales,
|
||||
})
|
||||
.MergeTable()
|
||||
.WhereIF(predicate != null, predicate)
|
||||
.OrderByIF(orderByPredicate != null, orderByPredicate, orderByType)
|
||||
.WithCacheIF(isDataCache, cacheTimes)
|
||||
.Take(take).ToListAsync();
|
||||
}
|
||||
return page;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据条件查询一定数量数据(用于组件)
|
||||
|
||||
/// <summary>
|
||||
/// 根据条件查询一定数量数据(用于组件)
|
||||
/// </summary>
|
||||
/// <param name="predicate">条件表达式树</param>
|
||||
/// <param name="take">获取数量</param>
|
||||
/// <param name="orderByType">排序顺序</param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <param name="isDataCache">是否缓存</param>
|
||||
/// <param name="cacheTimes">缓存时间(分钟)</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<GoodListDTO>> QueryListByComponentsAsync(Expression<Func<GoodListDTO, bool>> predicate, int take, string orderByType = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||
{
|
||||
List<GoodListDTO> page;
|
||||
if (blUseNoLock)
|
||||
{
|
||||
page = await DbClient.Queryable<CoreCmsGoods, CoreCmsProducts>((good, pd) => new JoinQueryInfos(
|
||||
JoinType.Left, good.id == pd.goodsId))
|
||||
.Where((good, pd) => pd.isDefalut == true && pd.isDel == false && good.isMarketable == true && good.isDel == false)
|
||||
.Select((good, pd) => new GoodListDTO
|
||||
{
|
||||
id = good.id,
|
||||
name = good.name,
|
||||
brief = good.brief,
|
||||
image = !SqlFunc.IsNullOrEmpty(good.image) ? good.image : EmptyOrNullImagePath.GoodImage,
|
||||
video = good.video,
|
||||
goodsCategoryId = good.goodsCategoryId,
|
||||
goodsTypeId = good.goodsTypeId,
|
||||
brandId = good.brandId,
|
||||
isNomalVirtual = good.isNomalVirtual,
|
||||
unit = good.unit,
|
||||
commentsCount = good.commentsCount,
|
||||
viewCount = good.viewCount,
|
||||
buyCount = SqlFunc.Subqueryable<CoreCmsOrderItem>()
|
||||
.LeftJoin<CoreCmsOrder>((sOrderItem, sOrder) => sOrder.orderId == sOrderItem.orderId)
|
||||
.Where((sOrderItem, sOrder) => sOrderItem.goodsId == good.id && (sOrder.payStatus == (int)GlobalEnumVars.OrderPayStatus.Yes || sOrder.payStatus == (int)GlobalEnumVars.OrderPayStatus.PartialYes))
|
||||
.Sum(p => p.nums),
|
||||
sort = good.sort,
|
||||
labelIds = good.labelIds,
|
||||
createTime = good.createTime,
|
||||
isRecommend = good.isRecommend,
|
||||
isHot = good.isHot,
|
||||
price = pd.price,
|
||||
mktprice = pd.mktprice,
|
||||
stock = pd.stock,
|
||||
pointsDeduction = pd.pointsDeduction,
|
||||
points = pd.points,
|
||||
weight = pd.weight,
|
||||
initialSales = good.initialSales,
|
||||
})
|
||||
.With(SqlWith.NoLock)
|
||||
.MergeTable()
|
||||
.WhereIF(predicate != null, predicate)
|
||||
.OrderByIF(!string.IsNullOrEmpty(orderByType), orderByType)
|
||||
.Take(take)
|
||||
.WithCacheIF(isDataCache, cacheTimes)
|
||||
.ToListAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
page = await DbClient.Queryable<CoreCmsGoods, CoreCmsProducts>((good, pd) => new JoinQueryInfos(
|
||||
JoinType.Left, good.id == pd.goodsId))
|
||||
.Where((good, pd) => pd.isDefalut == true && pd.isDel == false && good.isMarketable == true && good.isDel == false)
|
||||
.Select((good, pd) => new GoodListDTO
|
||||
{
|
||||
id = good.id,
|
||||
name = good.name,
|
||||
brief = good.brief,
|
||||
image = !SqlFunc.IsNullOrEmpty(good.image) ? good.image : EmptyOrNullImagePath.GoodImage,
|
||||
video = good.video,
|
||||
goodsCategoryId = good.goodsCategoryId,
|
||||
goodsTypeId = good.goodsTypeId,
|
||||
brandId = good.brandId,
|
||||
isNomalVirtual = good.isNomalVirtual,
|
||||
unit = good.unit,
|
||||
commentsCount = good.commentsCount,
|
||||
viewCount = good.viewCount,
|
||||
buyCount = SqlFunc.Subqueryable<CoreCmsOrderItem>()
|
||||
.LeftJoin<CoreCmsOrder>((sOrderItem, sOrder) => sOrder.orderId == sOrderItem.orderId)
|
||||
.Where((sOrderItem, sOrder) => sOrderItem.goodsId == good.id && (sOrder.payStatus == (int)GlobalEnumVars.OrderPayStatus.Yes || sOrder.payStatus == (int)GlobalEnumVars.OrderPayStatus.PartialYes))
|
||||
.Sum(p => p.nums),
|
||||
sort = good.sort,
|
||||
labelIds = good.labelIds,
|
||||
createTime = good.createTime,
|
||||
isRecommend = good.isRecommend,
|
||||
isHot = good.isHot,
|
||||
price = pd.price,
|
||||
mktprice = pd.mktprice,
|
||||
stock = pd.stock,
|
||||
pointsDeduction = pd.pointsDeduction,
|
||||
points = pd.points,
|
||||
weight = pd.weight,
|
||||
initialSales = good.initialSales,
|
||||
})
|
||||
.MergeTable()
|
||||
.WhereIF(predicate != null, predicate)
|
||||
.OrderByIF(!string.IsNullOrEmpty(orderByType), orderByType)
|
||||
.WithCacheIF(isDataCache, cacheTimes)
|
||||
.Take(take).ToListAsync();
|
||||
}
|
||||
return page;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user