using Microsoft.AspNetCore.Authorization; using Sanhe.Abp.Auditing.Features; using Sanhe.Abp.Auditing.Permissions; using Sanhe.Abp.AuditLogging; using System; using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Features; namespace Sanhe.Abp.Auditing.AuditLogs; [Authorize(AuditingPermissionNames.AuditLog.Default)] [RequiresFeature(AuditingFeatureNames.Logging.AuditLog)] public class EntityChangesAppService : AuditingApplicationServiceBase, IEntityChangesAppService { protected IEntityChangeStore EntityChangeStore { get; } public EntityChangesAppService(IEntityChangeStore entityChangeStore) { EntityChangeStore = entityChangeStore; } public async virtual Task GetAsync(Guid id) { var entityChange = await EntityChangeStore.GetAsync(id); return ObjectMapper.Map(entityChange); } public async virtual Task> GetListAsync(EntityChangeGetByPagedDto input) { var totalCount = await EntityChangeStore.GetCountAsync( input.AuditLogId, input.StartTime, input.EndTime, input.ChangeType, input.EntityId, input.EntityTypeFullName); var entityChanges = await EntityChangeStore.GetListAsync( input.Sorting, input.MaxResultCount, input.SkipCount, input.AuditLogId, input.StartTime, input.EndTime, input.ChangeType, input.EntityId, input.EntityTypeFullName); return new PagedResultDto(totalCount, ObjectMapper.Map, List>(entityChanges)); } public async virtual Task GetWithUsernameAsync(Guid id) { var entityChangeWithUsername = await EntityChangeStore.GetWithUsernameAsync(id); return ObjectMapper.Map(entityChangeWithUsername); } public async virtual Task> GetWithUsernameAsync(EntityChangeGetWithUsernameDto input) { var entityChangeWithUsernames = await EntityChangeStore.GetWithUsernameAsync( input.EntityId, input.EntityTypeFullName); return new ListResultDto( ObjectMapper.Map, List>(entityChangeWithUsernames)); } }