namespace Admin.NET.Core.Service;
///
/// 系统异常日志服务
///
[ApiDescriptionSettings(Name = "异常日志", Order = 178)]
public class SysExLogService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository _sysExLogRep;
public SysExLogService(SqlSugarRepository sysExLogRep)
{
_sysExLogRep = sysExLogRep;
}
///
/// 获取异常日志分页列表
///
///
[HttpGet("/sysExLog/pageList")]
[NotLog]
public async Task> GetExLogList([FromQuery] PageLogInput input)
{
return await _sysExLogRep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.StartTime.ToString()) && !string.IsNullOrWhiteSpace(input.EndTime.ToString()),
u => u.CreateTime >= input.StartTime && u.CreateTime <= input.EndTime)
.OrderBy(u => u.CreateTime, SqlSugar.OrderByType.Desc)
.ToPagedListAsync(input.Page, input.PageSize);
}
///
/// 清空异常日志
///
///
[HttpPost("/sysExLog/clear")]
public async Task ClearExLog()
{
return await _sysExLogRep.DeleteAsync(u => u.Id > 0);
}
}