From 790ac40f4e25c84ccc7934a49468837aaf151827 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Mon, 11 May 2026 16:30:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=88=90=E5=8E=86=E5=8F=B2=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Reading/Dto/SegmentationViewModel.cs | 4 ++++ .../Service/Reading/Segment/SegmentationService.cs | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/SegmentationViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/SegmentationViewModel.cs index e05e3d905..9f4626b2a 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/SegmentationViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/SegmentationViewModel.cs @@ -104,6 +104,10 @@ public class SegmentationVersionView public class SaveSegmentationVersionAsyncInDto { public Guid SegmentationId { get; set; } + + public string SEGUrl { get; set; } + + public bool IsRestore { get; set; } = false; } public class SegmentationVersionQuery : PageInput diff --git a/IRaCIS.Core.Application/Service/Reading/Segment/SegmentationService.cs b/IRaCIS.Core.Application/Service/Reading/Segment/SegmentationService.cs index c5d9e94e7..2709032f1 100644 --- a/IRaCIS.Core.Application/Service/Reading/Segment/SegmentationService.cs +++ b/IRaCIS.Core.Application/Service/Reading/Segment/SegmentationService.cs @@ -78,7 +78,7 @@ public class SegmentationService(IRepository _segmentationReposito if (addOrEditSegmentation.Id != null) { - await SaveSegmentationVersionAsync(new SaveSegmentationVersionAsyncInDto() { SegmentationId = addOrEditSegmentation.Id.Value }); + await SaveSegmentationVersionAsync(new SaveSegmentationVersionAsyncInDto() { SegmentationId = addOrEditSegmentation.Id.Value,SEGUrl=addOrEditSegmentation.SEGUrl }); } var entity = await _segmentationRepository.InsertOrUpdateAsync(addOrEditSegmentation, true); return ResponseOutput.Ok(entity.Id.ToString()); @@ -94,7 +94,7 @@ public class SegmentationService(IRepository _segmentationReposito var data = await _segmentationRepository.FirstOrDefaultNoTrackingAsync(x => x.Id == inDto.SegmentationId); var segmentList = await _segmentRepository.Where(x => x.SegmentationId == inDto.SegmentationId).OrderBy(x=>x.SegmentNumber).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); - if (data.SEGUrl != string.Empty) + if (data.SEGUrl != string.Empty&&(inDto.SEGUrl!=data.SEGUrl||inDto.IsRestore)) { // 如果是新增或修改,记录一条版本信息 var maxVersion = await _segmentationVersionRepository @@ -152,7 +152,7 @@ public class SegmentationService(IRepository _segmentationReposito var version = await _segmentationVersionRepository.Where(x => x.Id == inDto.VersionId && x.SegmentationId == inDto.SegmentationId).FirstNotNullAsync(); var segmentation = await _segmentationRepository.Where(x => x.Id == inDto.SegmentationId).FirstNotNullAsync(); - await SaveSegmentationVersionAsync(new SaveSegmentationVersionAsyncInDto() { SegmentationId=inDto.SegmentationId}); + await SaveSegmentationVersionAsync(new SaveSegmentationVersionAsyncInDto() { SegmentationId=inDto.SegmentationId,IsRestore=true,}); await _segmentationRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.SegmentationId, t => new Segmentation { SegmentationJson = version.SegmentationJson,