From 9e4cf1d1db7967314dfe38e599626aec8a7e3362 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Mon, 17 Mar 2025 16:44:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Doctor/AttachmentService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Doctor/AttachmentService.cs b/IRaCIS.Core.Application/Service/Doctor/AttachmentService.cs index 06c292998..3f8f19061 100644 --- a/IRaCIS.Core.Application/Service/Doctor/AttachmentService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/AttachmentService.cs @@ -215,7 +215,7 @@ namespace IRaCIS.Core.Application.Service if (!attachment.Path.Contains(attachment.DoctorId.ToString())) { - var attachmentData= await _attachmentrepository.FirstOrDefaultAsync(a => a.Id == attachment.Id); + var attachmentData= await _attachmentrepository.Where(a => a.Id == attachment.Id).FirstNotNullAsync(); var fileName= attachmentData.Path.Split("/").Last(); @@ -228,7 +228,7 @@ namespace IRaCIS.Core.Application.Service if (attachment.DoctorId != null) { - await _attachmentrepository.DeleteFromQueryAsync(a => a.DoctorId == attachment.DoctorId && a.Type == attachment.Type); + await _attachmentrepository.DeleteFromQueryAsync(a =>a.Id!=attachment.Id&& a.DoctorId == attachment.DoctorId && a.Type == attachment.Type); } attachment.UpdateTime = DateTime.Now;