CloudGamingAdmin/admin-server/CloudGaming.Api.Admin/ApplicationServices/Apps/User/T_User_IntentOrderService.cs
2024-12-04 14:22:48 +08:00

47 lines
1.9 KiB
C#

using CloudGaming.Repository.Game.Entities.User;
namespace CloudGaming.Api.Admin.ApplicationServices.Apps.User;
/// <summary>
/// 意向订单表 服务 T_User_IntentOrderService
/// </summary>
public class T_User_IntentOrderService(IServiceProvider serviceProvider)
: ApplicationUserService<T_User_IntentOrder,int,T_User_IntentOrder,T_User_IntentOrder>(serviceProvider)
{
/// <summary>
/// 获取列表数据
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
public async override Task<PagingView> FindListAsync(PagingSearchInput<T_User_IntentOrder> pagingSearchInput)
{
var query = this.Repository.Select
//产品id
.WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.ProductId),
w => w.ProductId.Contains(pagingSearchInput.Search.ProductId ?? ""))
//用户Id
.WhereIf(pagingSearchInput.Search?.UserId!=null&&pagingSearchInput.Search?.UserId>0,
w => w.UserId== pagingSearchInput.Search.UserId)
.OrderByDescending(w => w.Id)
.Select(w => new
{
w.Id,
w.UserId,w.ProductId,w.Method,w.Price,w.Quantity,w.Status,w.Notes,w.CreatedAt,w.UpdatedAt,w.TenantId,w.OrderId,w.CreatedDay,w.Channel,
})
;
var result = await Repository.AsPagingViewAsync(query, pagingSearchInput);
// 设置列
//result.GetColumn(query, w => w.OperatorName).SetColumn("操作人");
//result.GetColumn(query, w => w. !).SetColumn<SysUser>(w => w.Name!);
result
.FormatValue(query, w => w.CreatedAt, (oldValue) => oldValue.ToString("yyyy-MM-dd HH:mm:ss"))
.FormatValue(query, w => w.UpdatedAt, (oldValue) => oldValue.ToString("yyyy-MM-dd HH:mm:ss"))
;
return result;
}
}