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
{
///
/// 系统差异日志服务 🧩
///
[Scope("SingleInstance")]
public class SysLogDiffService : BaseServices
{
private readonly SysLogDiffRepository _sysLogDiffRep;
public SysLogDiffService(SysLogDiffRepository sysLogDiffRep)
{
_sysLogDiffRep = sysLogDiffRep;
}
///
/// 获取差异日志分页列表 🔖
///
///
public async Task> Page(PageLogReq input)
{
RefAsync total = 0;
var items = await _sysLogDiffRep.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 _sysLogDiffRep.DeleteAsync(u => u.Id > 0);
}
}
}