Browse Source

提交

groupmealmanage
gwbvipvip 6 months ago
parent
commit
50a4581680
5 changed files with 66 additions and 0 deletions
  1. BIN
     
  2. BIN
     
  3. +12
    -0
      BPA.SAAS.Manage.Application/DataBase/GoodsServices.cs
  4. +10
    -0
      BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsService.cs
  5. +44
    -0
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs

BIN
View File


BIN
View File


+ 12
- 0
BPA.SAAS.Manage.Application/DataBase/GoodsServices.cs View File

@@ -148,6 +148,18 @@ namespace BPA.SAAS.Manage.Application.DataBase
{
return await _goodsService.GetGoods(id);
}

/// <summary>
/// 更具id查询商品信息列表
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpGet("/api/goods/GetGoodsList")]
public async Task<List<GoodsInfoBaseView>> GetGoodsList(List<string> ids)
{
return await _goodsService.GetGoodsList(ids);
}

///// <summary>
///// 设备上传商品数据
///// </summary>


+ 10
- 0
BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsService.cs View File

@@ -73,6 +73,16 @@ namespace BPA.SAAS.Manage.Application.DataBase.Interface
/// <param name="id"></param>
/// <returns></returns>
Task<GoodsInfoBaseView> GetGoods(string id);


/// <summary>
/// 更具id查询商品信息
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
Task<List<GoodsInfoBaseView>> GetGoodsList(List<string> ids);


///// <summary>
///// 设备上传商品数据
///// </summary>


+ 44
- 0
BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs View File

@@ -471,6 +471,50 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services

return res;
}

/// <summary>
/// 更具id查询商品信息
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public async Task<List<GoodsInfoBaseView>> GetGoodsList(List<string> ids)
{
var res = await _db.Queryable<BPA_GoodsInfo>()
.Where((a) => a.IsDeleted == 0 && ids.Contains(a.Id))
.OrderBy(a => a.CreateAt, OrderByType.Desc)
.Select((a) => new GoodsInfoBaseView
{
Id = a.Id,
Code = a.Code,
Name = a.Name,
Price = a.Price,
ImgUrl = a.ImgUrl,
Status = a.Status,
GoodsTypeId = a.GoodsTypeId,
GoodsTypeName = SqlFunc.Subqueryable<BPA_GoodsType>().Where(s => s.Id == a.GoodsTypeId && s.IsDeleted == 0).Select(s => s.Name),
Remark = a.Descritption,
// CreateAt = a.CreateAt,
GoodsUintId = a.GoodsUintId,
IsAttrubute = a.IsAttrubute,
GoodsUintName = SqlFunc.Subqueryable<BPA_GoodsUint>().Where(s => s.Id == a.GoodsUintId && s.IsDeleted == 0).Select(s => s.Name),
//GoodsAttributeList = new List<GoodsAttributeList>()
}).ToListAsync();

foreach (var item in res)
{
if (!item.IsAttrubute)
{
item.GoodsAttributeList = await _goodsAttributeService.GetByNameAttribute("默认属性");
}
else
{
item.GoodsAttributeList = await _goodsAttributeService.GetByGoodsIdAttribute(item.Id);
}
}

return res;
}

public async Task<bool> ExportGood(IFormFile file)
{
bool isReplace = true;


Loading…
Cancel
Save