321
This commit is contained in:
parent
8c71ebe7eb
commit
d11d61b4f1
|
|
@ -559,11 +559,24 @@ public class StatisticsService : IStatisticsService
|
||||||
var total = await query.CountAsync();
|
var total = await query.CountAsync();
|
||||||
|
|
||||||
// 分页获取盒子列表
|
// 分页获取盒子列表
|
||||||
var goods = await query
|
var goodsData = await query
|
||||||
.OrderByDescending(g => g.Id)
|
.OrderByDescending(g => g.Id)
|
||||||
.Skip(request.Skip)
|
.Skip(request.Skip)
|
||||||
.Take(request.PageSize)
|
.Take(request.PageSize)
|
||||||
.Select(g => new BoxProfitItem
|
.Select(g => new
|
||||||
|
{
|
||||||
|
g.Id,
|
||||||
|
g.Title,
|
||||||
|
g.ImgUrl,
|
||||||
|
g.Price,
|
||||||
|
g.Stock,
|
||||||
|
g.Status,
|
||||||
|
g.Type
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
// 在内存中映射类型名称(避免 EF Core 无法翻译字典方法的问题)
|
||||||
|
var goods = goodsData.Select(g => new BoxProfitItem
|
||||||
{
|
{
|
||||||
Id = g.Id,
|
Id = g.Id,
|
||||||
Title = g.Title,
|
Title = g.Title,
|
||||||
|
|
@ -572,7 +585,7 @@ public class StatisticsService : IStatisticsService
|
||||||
Stock = g.Stock,
|
Stock = g.Stock,
|
||||||
Status = g.Status,
|
Status = g.Status,
|
||||||
Type = g.Type,
|
Type = g.Type,
|
||||||
TypeName = BoxTypeNames.ContainsKey(g.Type) ? BoxTypeNames[g.Type] : "未知类型",
|
TypeName = BoxTypeNames.GetValueOrDefault(g.Type, "未知类型"),
|
||||||
// 统计数据初始化为0,后续异步加载
|
// 统计数据初始化为0,后续异步加载
|
||||||
UseMoney = 0,
|
UseMoney = 0,
|
||||||
ScMoney = 0,
|
ScMoney = 0,
|
||||||
|
|
@ -583,8 +596,7 @@ public class StatisticsService : IStatisticsService
|
||||||
ProfitRate = 0,
|
ProfitRate = 0,
|
||||||
IsNegative = false,
|
IsNegative = false,
|
||||||
Loaded = false
|
Loaded = false
|
||||||
})
|
}).ToList();
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
return PagedResult<BoxProfitItem>.Create(goods, total, request.Page, request.PageSize);
|
return PagedResult<BoxProfitItem>.Create(goods, total, request.Page, request.PageSize);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user