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

60 lines
2.2 KiB
C#

using CloudGaming.Repository.Game.Entities.Ext;
namespace CloudGaming.Api.Admin.ApplicationServices.Apps.Ext;
/// <summary>
/// App配置表 服务 T_App_ConfigService
/// </summary>
public class T_App_ConfigService(IServiceProvider serviceProvider)
: ApplicationGameService<T_App_Config, int, T_App_Config, T_App_Config>(serviceProvider)
{
/// <summary>
/// 获取列表数据
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
public async override Task<PagingView> FindListAsync(PagingSearchInput<T_App_Config> pagingSearchInput)
{
var query = this.Repository.Select
//配置类型
.WhereIf(pagingSearchInput.Search?.ConfigType != null && pagingSearchInput.Search?.ConfigType > 0,
w => w.ConfigType == pagingSearchInput.Search.ConfigType)
//配置名称
.WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.Name),
w => w.Name.Contains(pagingSearchInput.Search.Name ?? ""))
.OrderByDescending(w => w.Id)
.Select(w => new
{
w.Id,
w.ConfigId,
w.ConfigType,
w.ActionId,
w.ConfigValue,
w.IsEnabled,
w.Name,
w.Desc,
w.ChannelId,
w.Plat,
w.AppVersion,
w.Continent,
w.CountryName,
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 HH:mm:ss"))
.FormatValue(query, w => w.UpdateTime, (oldValue) => oldValue.ToString("yyyy-MM-dd HH:mm:ss"))
;
return result;
}
}