|
|
@@ -0,0 +1,54 @@ |
|
|
|
using BPA.KitChen.GroupMeal.SqlSugar; |
|
|
|
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.WeighingService.Dtos; |
|
|
|
using BPA.SAAS.Manage.Core.DataBase; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Text; |
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WeighingService.Services |
|
|
|
{ |
|
|
|
public class WeighingService: IWeighingService, ITransient |
|
|
|
{ |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 获取商品信息 |
|
|
|
/// </summary> |
|
|
|
/// <returns></returns> |
|
|
|
public async Task<List<GoodsTypeDto>> GetGoodsInfo() |
|
|
|
{ |
|
|
|
//获取商品类型 |
|
|
|
var goodsType =await SqlSugarDb.Db.Queryable<BPA_GoodsType>().OrderBy(x=>x.Sort) |
|
|
|
.Select(x=>new GoodsTypeDto() |
|
|
|
{ |
|
|
|
Id = x.Id, |
|
|
|
Name = x.Name, |
|
|
|
Sort = x.Sort, |
|
|
|
}).ToListAsync(); |
|
|
|
|
|
|
|
//获取商品 |
|
|
|
var goods = await SqlSugarDb.Db.Queryable<BPA_GoodsInfo>().OrderBy(x => x.Sort) |
|
|
|
.Select(x => new GoodsDto() |
|
|
|
{ |
|
|
|
Id=x.Id, |
|
|
|
Name=x.Name, |
|
|
|
Sort=x.Sort, |
|
|
|
Cover=x.ImgUrl, |
|
|
|
GoodsTypeId = x.GoodsTypeId, |
|
|
|
}).ToListAsync(); |
|
|
|
|
|
|
|
//获取商品属性价格 |
|
|
|
|
|
|
|
// var goodsPrice= await SqlSugarDb.Db.Queryable<BPA_GoodsInfo>().OrderBy(x => x.Sort) |
|
|
|
|
|
|
|
foreach (var item in goodsType) |
|
|
|
{ |
|
|
|
var data= goods.Where(x=>x.GoodsTypeId==item.Id).ToList(); |
|
|
|
item.Foods = data; |
|
|
|
} |
|
|
|
|
|
|
|
return goodsType; |
|
|
|
} |
|
|
|
} |
|
|
|
} |