From 278300a4f47746ef53f5efea78e4073d621d12f5 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Tue, 28 Apr 2026 16:46:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=96=B0=E5=A2=9E=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E7=BC=96=E7=A0=81=E5=94=AF=E4=B8=80=E6=80=A7?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在保存预约区域时,新增对 CustomCode 的唯一性校验,防止插入重复编码,若已存在则抛出异常提示“编码已存在”。 --- .../Appointment/Services/Implements/AppointmentAreaService.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Src/Dlhis.Basic/Appointment/Services/Implements/AppointmentAreaService.cs b/Src/Dlhis.Basic/Appointment/Services/Implements/AppointmentAreaService.cs index cb71525a..07e0b386 100644 --- a/Src/Dlhis.Basic/Appointment/Services/Implements/AppointmentAreaService.cs +++ b/Src/Dlhis.Basic/Appointment/Services/Implements/AppointmentAreaService.cs @@ -26,6 +26,10 @@ public class AppointmentAreaService : IAppointmentAreaService { if (!request.Id.HasValue) { + + var exists = await _dbContext.Queryable().Where(x => x.CustomCode == request.CustomCode).AnyAsync(); + exists.ThrowIfTrue("编码已存在"); + var entity = request.Adapt(); entity.CustomCode = request.CustomCode; entity.Type = request.Type;