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.
62 lines
2.4 KiB
62 lines
2.4 KiB
3 years ago
|
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<EntityChangeDto> GetAsync(Guid id)
|
||
|
{
|
||
|
var entityChange = await EntityChangeStore.GetAsync(id);
|
||
|
|
||
|
return ObjectMapper.Map<EntityChange, EntityChangeDto>(entityChange);
|
||
|
}
|
||
|
|
||
|
public async virtual Task<PagedResultDto<EntityChangeDto>> 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<EntityChangeDto>(totalCount,
|
||
|
ObjectMapper.Map<List<EntityChange>, List<EntityChangeDto>>(entityChanges));
|
||
|
}
|
||
|
|
||
|
public async virtual Task<EntityChangeWithUsernameDto> GetWithUsernameAsync(Guid id)
|
||
|
{
|
||
|
var entityChangeWithUsername = await EntityChangeStore.GetWithUsernameAsync(id);
|
||
|
|
||
|
return ObjectMapper.Map<EntityChangeWithUsername, EntityChangeWithUsernameDto>(entityChangeWithUsername);
|
||
|
}
|
||
|
|
||
|
public async virtual Task<ListResultDto<EntityChangeWithUsernameDto>> GetWithUsernameAsync(EntityChangeGetWithUsernameDto input)
|
||
|
{
|
||
|
var entityChangeWithUsernames = await EntityChangeStore.GetWithUsernameAsync(
|
||
|
input.EntityId, input.EntityTypeFullName);
|
||
|
|
||
|
return new ListResultDto<EntityChangeWithUsernameDto>(
|
||
|
ObjectMapper.Map<List<EntityChangeWithUsername>, List<EntityChangeWithUsernameDto>>(entityChangeWithUsernames));
|
||
|
}
|
||
|
}
|