diff --git a/IRaCIS.Core.Domain/Document/TrialDocument.cs b/IRaCIS.Core.Domain/Document/TrialDocument.cs index b25c5f3a8..e99be270a 100644 --- a/IRaCIS.Core.Domain/Document/TrialDocument.cs +++ b/IRaCIS.Core.Domain/Document/TrialDocument.cs @@ -14,7 +14,7 @@ namespace IRaCIS.Core.Domain.Models /// [Table("TrialDocument")] public class TrialDocument : Entity, IAuditUpdate, IAuditAdd - { + { //需要确认的项目用户 通过TrialId 关联 用中间表过滤 diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 489031af6..b4424a4e9 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -69,18 +69,40 @@ namespace IRaCIS.Core.Infra.EFCore.Common typeof(TrialSiteSurvey), typeof(TrialSiteUser), typeof(VisitStage), - typeof(TrialSite) - }; + typeof(TrialSite), + + }; } } + // 修改为删除 + private List UpdateIsDelete + { + get + { + return new List() + { + typeof(TrialDocument) + }; + } + } - public string GetEntityAuditOpt(EntityEntry entityEntry) + + public string GetEntityAuditOpt(EntityEntry entityEntry) { if (entityEntry.State == EntityState.Added) { return AuditOpt.Add; } + else if ( + UpdateIsDelete.Contains(entityEntry.Entity.GetType()) + && entityEntry.State == EntityState.Modified + && (bool)entityEntry.Entity.GetType().GetProperty(nameof(ISoftDelete.IsDeleted)).GetValue(entityEntry.Entity) + + ) + { + return AuditOpt.Deleted; + } else if (entityEntry.State == EntityState.Deleted || (entityEntry.State == EntityState.Modified