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 SysLogDiffService : BaseServices<SysLogDiff>
{
private readonly SysLogDiffRepository _sysLogDiffRep;
public SysLogDiffService(SysLogDiffRepository sysLogDiffRep)
{
_sysLogDiffRep = sysLogDiffRep;
}
/// <summary>
/// 获取差异日志分页列表 🔖
/// </summary>
/// <returns></returns>
public async Task<SqlSugarPagedList<SysLogDiff>> Page(PageLogReq input)
{
RefAsync<int> total = 0;
var items = await _sysLogDiffRep.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 _sysLogDiffRep.DeleteAsync(u => u.Id > 0);
}
}
}