using Entity.Base;
using Entity.DbModel.System;
using Entity.Dto.Req;
using HybirdFrameworkCore.Autofac.Attribute;
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.Page, input.PageSize, total
);
return SqlSugarPagedExtensions.CreateSqlSugarPagedList(items, total, input.Page, input.PageSize);
}
///
/// 清空访问日志 🔖
///
///
public async Task Clear()
{
return await _sysLogVisRep.DeleteAsync(u => u.Id > 0);
}
}
}