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.

48 lines
1.5 KiB

7 months ago
using Entity.Base;
using Entity.DbModel.System.SysBaseObject;
using Entity.Dto.Req;
using HybirdFrameworkCore.Autofac.Attribute;
using Repository.System;
using SqlSugar;
namespace Service.System.SysLog
{
/// <summary>
/// 系统访问日志服务 🧩
/// </summary>
[Scope("SingleInstance")]
public class SysLogVisService : BaseServices<SysLogVis>
{
private readonly SysLogVisRepository _sysLogVisRep;
public SysLogVisService(SysLogVisRepository sysLogVisRep)
{
_sysLogVisRep = sysLogVisRep;
}
/// <summary>
/// 获取访问日志分页列表 🔖
/// </summary>
/// <returns></returns>
public async Task<SqlSugarPagedList<SysLogVis>> Page(PageLogReq input)
{
RefAsync<int> total = 0;
var items = await _sysLogVisRep.QueryPageAsync(
!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);
}
/// <summary>
/// 清空访问日志 🔖
/// </summary>
/// <returns></returns>
public async Task<bool> Clear()
{
return await _sysLogVisRep.DeleteAsync(u => u.Id > 0);
}
}
}