using CloudGaming.Repository.Game.Entities.App;
namespace CloudGaming.Api.Admin.ApplicationServices.Apps.App;
///
/// 兑换码使用表 服务 T_User_RedemptionUsageService
///
public class T_User_RedemptionUsageService(IServiceProvider serviceProvider)
: ApplicationUserService(serviceProvider)
{
///
/// 获取列表数据
///
///
///
public async override Task FindListAsync(PagingSearchInput pagingSearchInput)
{
var query = this.Repository.Select
//兑换码
.WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.Code),
w => w.Code.Contains(pagingSearchInput.Search.Code ?? ""))
//用户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.Code,w.RedemptionCodeId,w.UserId,w.UsedDate,w.OrderId,w.Status,w.Remarks,w.TenantId,
})
;
var result = await Repository.AsPagingViewAsync(query, pagingSearchInput);
// 设置列
//result.GetColumn(query, w => w.OperatorName).SetColumn("操作人");
//result.GetColumn(query, w => w. !).SetColumn(w => w.Name!);
result
.FormatValue(query, w => w.UsedDate, (oldValue) => oldValue.ToString("yyyy-MM-dd"))
;
return result;
}
}