CloudGamingAdmin/admin-server/CloudGaming.Api.Admin/ApplicationServices/Apps/App/T_PopupService.cs
2024-11-18 11:53:49 +08:00

60 lines
2.1 KiB
C#

using CloudGaming.Repository.Game.Entities.App;
namespace CloudGaming.Api.Admin.ApplicationServices.Apps.App;
/// <summary>
/// 通用弹框配置 服务 T_PopupService
/// </summary>
public class T_PopupService(IServiceProvider serviceProvider)
: ApplicationUserService<T_Popup, int, T_Popup, T_Popup>(serviceProvider)
{
/// <summary>
/// 获取列表数据
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
public async override Task<PagingView> FindListAsync(PagingSearchInput<T_Popup> pagingSearchInput)
{
var query = this.Repository.Select
//弹框名称
.WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.Name),
w => w.Name.Contains(pagingSearchInput.Search.Name ?? ""))
//弹框类型
.WhereIf(pagingSearchInput.Search?.Type != null && pagingSearchInput.Search?.Type > 0,
w => w.Type == pagingSearchInput.Search.Type)
.OrderBy(w => w.OrderId)
.Select(w => new
{
w.Id,
w.TenantId,
w.Type,
w.Name,
w.Text,
w.OrderId,
w.BgImageId,
w.Btn_OK,
w.Btn_Close,
w.Desc,
w.Channel,
w.PlatformId,
w.IsOnline,
w.CreateTime,
w.UpdateTime,
})
;
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.CreateTime, (oldValue) => oldValue?.ToString("yyyy-MM-dd"))
.FormatValue(query, w => w.UpdateTime, (oldValue) => oldValue?.ToString("yyyy-MM-dd"))
;
return result;
}
}