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.

56 lines
1.7 KiB

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
{
/// <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<PageResult<SysLogVis>> Page(PageLogReq input)
{
RefAsync<int> 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<SysLogVis>()
{
PageNum = input.PageNum,
PageSize = input.PageSize,
ToTal = total,
Rows = items,
};
}
/// <summary>
/// 清空访问日志 🔖
/// </summary>
/// <returns></returns>
public async Task<bool> Clear()
{
return await _sysLogVisRep.DeleteAsync(u => u.Id > 0);
}
}
}