namespace Admin.NET.Core.Service; /// /// 系统访问日志服务 /// [ApiDescriptionSettings(Order = 340)] public class SysLogVisService : IDynamicApiController, ITransient { private readonly SqlSugarRepository _sysLogVisRep; public SysLogVisService(SqlSugarRepository sysLogVisRep) { _sysLogVisRep = sysLogVisRep; } /// /// 获取访问日志分页列表 /// /// [SuppressMonitor] [DisplayName("获取访问日志分页列表")] public async Task> 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); } /// /// 清空访问日志 /// /// [ApiDescriptionSettings(Name = "Clear"), HttpPost] [DisplayName("清空访问日志")] public async Task Clear() { return await _sysLogVisRep.DeleteAsync(u => u.Id > 0); } }