Admin.net框架
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.3 KiB

5 days ago
namespace Admin.NET.Core.Service;
/// <summary>
/// 系统访问日志服务
/// </summary>
[ApiDescriptionSettings(Order = 340)]
public class SysLogVisService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<SysLogVis> _sysLogVisRep;
public SysLogVisService(SqlSugarRepository<SysLogVis> sysLogVisRep)
{
_sysLogVisRep = sysLogVisRep;
}
/// <summary>
/// 获取访问日志分页列表
/// </summary>
/// <returns></returns>
[SuppressMonitor]
[DisplayName("获取访问日志分页列表")]
public async Task<SqlSugarPagedList<SysLogVis>> Page(PageLogInput input)
{
return await _sysLogVisRep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.StartTime.ToString()), u => u.CreateTime >= input.StartTime)
.WhereIF(!string.IsNullOrWhiteSpace(input.EndTime.ToString()), u => u.CreateTime <= input.EndTime)
.OrderBy(u => u.CreateTime, OrderByType.Desc)
.ToPagedListAsync(input.Page, input.PageSize);
}
/// <summary>
/// 清空访问日志
/// </summary>
/// <returns></returns>
[ApiDescriptionSettings(Name = "Clear"), HttpPost]
[DisplayName("清空访问日志")]
public async Task<bool> Clear()
{
return await _sysLogVisRep.DeleteAsync(u => u.Id > 0);
}
}