From 4966a32bcb2d2be099da2bddcfaedf91fa6650cb Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Mon, 27 May 2024 15:07:46 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Domain/Document/TrialDocument.cs | 2 +- .../Common/AuditingData.cs | 28 +++++++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) 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