You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

131 lines
5.8 KiB
C#

using System.Net;
using NPin.Framework.AuditLogging.Domain.Entities;
using NPin.Framework.AuditLogging.Domain.Events;
using NPin.Framework.SqlSugarCore.Abstractions;
using Volo.Abp.Auditing;
namespace NPin.Framework.AuditLogging.Domain.Repositories;
public interface IAuditLogRepository : ISqlSugarRepository<AuditLogAggregateRoot, Guid>
{
/// <summary>
/// 获取每日平均执行时长
/// </summary>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<Dictionary<DateTime, double>> GetAverageExecutionDurationPerDayAsync(DateTime startDate, DateTime endDate,
CancellationToken cancellationToken = default);
/// <summary>
/// 获取数量
/// </summary>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="httpMethod"></param>
/// <param name="url"></param>
/// <param name="userId"></param>
/// <param name="userName"></param>
/// <param name="applicationName"></param>
/// <param name="clientIpAddress"></param>
/// <param name="correlationId"></param>
/// <param name="maxExecutionDuration"></param>
/// <param name="minExecutionDuration"></param>
/// <param name="hasException"></param>
/// <param name="httpStatusCode"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<long> GetCountAsync(DateTime? startTime = null, DateTime? endTime = null, string httpMethod = null,
string url = null, Guid? userId = null, string userName = null, string applicationName = null,
string clientIpAddress = null, string correlationId = null, int? maxExecutionDuration = null,
int? minExecutionDuration = null, bool? hasException = null, HttpStatusCode? httpStatusCode = null,
CancellationToken cancellationToken = default);
/// <summary>
/// 获取实体改变日志
/// </summary>
/// <param name="entityChangeId"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<EntityChangeEntity> GetEntityChange(Guid entityChangeId, CancellationToken cancellationToken = default);
/// <summary>
/// 获取实体改变日志数量
/// </summary>
/// <param name="auditLogId"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="changeType"></param>
/// <param name="entityId"></param>
/// <param name="entityTypeFullName"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<long> GetEntityChangeCountAsync(Guid? auditLogId = null, DateTime? startTime = null, DateTime? endTime = null,
EntityChangeType? changeType = null, string entityId = null, string entityTypeFullName = null,
CancellationToken cancellationToken = default);
/// <summary>
/// 获取实体改变日志列表
/// </summary>
/// <param name="sorting"></param>
/// <param name="maxResultCount"></param>
/// <param name="skipCount"></param>
/// <param name="auditLogId"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="changeType"></param>
/// <param name="entityId"></param>
/// <param name="entityTypeFullName"></param>
/// <param name="includeDetails"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<List<EntityChangeEntity>> GetEntityChangeListAsync(string sorting = null, int maxResultCount = 50,
int skipCount = 0, Guid? auditLogId = null, DateTime? startTime = null, DateTime? endTime = null,
EntityChangeType? changeType = null, string entityId = null, string entityTypeFullName = null,
bool includeDetails = false, CancellationToken cancellationToken = default);
/// <summary>
/// 获取用户名改变日志列表
/// </summary>
/// <param name="entityId"></param>
/// <param name="entityTypeFullName"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<List<EntityChangeWithUsername>> GetEntityChangesWithUsernameAsync(string entityId, string entityTypeFullName,
CancellationToken cancellationToken = default);
/// <summary>
/// 获取用户名改变日志
/// </summary>
/// <param name="entityChangeId"></param>
/// <returns></returns>
Task<EntityChangeWithUsername> GetEntityChangeWithUsernameAsync(Guid entityChangeId);
/// <summary>
/// 获取审计日志列表
/// </summary>
/// <param name="sorting"></param>
/// <param name="maxResultCount"></param>
/// <param name="skipCount"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="httpMethod"></param>
/// <param name="url"></param>
/// <param name="userId"></param>
/// <param name="userName"></param>
/// <param name="applicationName"></param>
/// <param name="clientIpAddress"></param>
/// <param name="correlationId"></param>
/// <param name="maxExecutionDuration"></param>
/// <param name="minExecutionDuration"></param>
/// <param name="hasException"></param>
/// <param name="httpStatusCode"></param>
/// <param name="includeDetails"></param>
/// <returns></returns>
Task<List<AuditLogAggregateRoot>> GetListAsync(string sorting = null, int maxResultCount = 50, int skipCount = 0,
DateTime? startTime = null, DateTime? endTime = null, string httpMethod = null, string url = null,
Guid? userId = null, string userName = null, string applicationName = null, string clientIpAddress = null,
string correlationId = null, int? maxExecutionDuration = null, int? minExecutionDuration = null,
bool? hasException = null, HttpStatusCode? httpStatusCode = null, bool includeDetails = false);
}