using Entity.Base; using Entity.DbModel.System; using Entity.Dto.Req; using HybirdFrameworkCore.Autofac.Attribute; using HybirdFrameworkCore.Entity; using Repository.System; using SqlSugar; namespace Service.System.SysLog { /// /// 系统访问日志服务 🧩 /// [Scope("SingleInstance")] public class SysLogVisService : BaseServices { private readonly SysLogVisRepository _sysLogVisRep; public SysLogVisService(SysLogVisRepository sysLogVisRep) { _sysLogVisRep = sysLogVisRep; } /// /// 获取访问日志分页列表 🔖 /// /// public async Task> Page(PageLogReq input) { RefAsync total = 0; var items = await _sysLogVisRep.QueryPageAsync( entity => true, false, entity => true, !string.IsNullOrWhiteSpace(input.StartTime.ToString()), u => u.CreateTime >= input.StartTime, !string.IsNullOrWhiteSpace(input.EndTime.ToString()), u => u.CreateTime <= input.EndTime, u => u.CreateTime, input.PageNum, input.PageSize, total ); return new PageResult() { PageNum = input.PageNum, PageSize = input.PageSize, ToTal = total, Rows = items, }; } /// /// 清空访问日志 🔖 /// /// public async Task Clear() { return await _sysLogVisRep.DeleteAsync(u => u.Id > 0); } } }