Commit bdbc7607 authored by liudong1993's avatar liudong1993

订单已售数量

parent 8a54e55d
......@@ -22,6 +22,10 @@ namespace Mall.Model.Extend.Product
/// </summary>
public int? GoodsId { get; set; }
/// <summary>
/// 商品购买的数量
/// </summary>
public int? GoodsBuyNum { get; set; }
/// <summary>
/// 视频播放方向 1向下 2向上
/// </summary>
public int? SelectVideoDirection { get; set; }
......
......@@ -3166,6 +3166,7 @@ namespace Mall.Module.Product
//查询分类
string ids = string.Join(",", list.Select(x => x.Id));
var clist = goods_CategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsIds = ids, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
var olist = goods_OrderRepository.GetGoodsOrderNum(ids);
foreach (var item in list)
{
item.CategoryList = clist.Where(x => x.GoodsId == item.Id).ToList();
......@@ -3178,6 +3179,8 @@ namespace Mall.Module.Product
item.CoverImage = CarouselIdList[0];
//轮播图
}
item.GoodsBuyNum = olist.Where(x => x.GoodsId == item.Id).FirstOrDefault()?.OrderNum ?? 0;
}
}
return list;
......
......@@ -393,7 +393,7 @@ WHERE od.GoodsId={goodsId} and o.`Status`=0 and o.OrderStatus <> 7 GROUP BY o.Us
public List<RB_Goods_Order_Extend> GetGoodsOrderNum(string goodsIds)
{
string sql2 = $@"
SELECT od.GoodsId ,SUM(od.Number) as GoodsNum FROM rb_goods_order o
SELECT od.GoodsId ,SUM(od.Number) as OrderNum FROM rb_goods_order o
INNER JOIN rb_goods_orderdetail od on o.OrderId=od.OrderId
WHERE od.GoodsId in({goodsIds}) and o.`Status`=0 and o.OrderStatus <> 7 group by od.GoodsId";
return Get<RB_Goods_Order_Extend>(sql2).ToList();
......
......@@ -1089,6 +1089,7 @@ namespace Mall.WebApi.Controllers.MallBase
x.SellingPrice,
x.InventoryNum,
x.SalesNum,
x.GoodsBuyNum,
x.IsQuickBuy,
x.GoodsStatus,
x.TenantId,
......
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