From 603a522c4b71432b21270fcee3bde7d4217a3fdc Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 12 May 2026 14:10:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8E=86=E5=8F=B2=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Reading/Segment/SegmentationService.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Reading/Segment/SegmentationService.cs b/IRaCIS.Core.Application/Service/Reading/Segment/SegmentationService.cs index 2709032f1..115f0fa5b 100644 --- a/IRaCIS.Core.Application/Service/Reading/Segment/SegmentationService.cs +++ b/IRaCIS.Core.Application/Service/Reading/Segment/SegmentationService.cs @@ -92,7 +92,15 @@ public class SegmentationService(IRepository _segmentationReposito private async Task SaveSegmentationVersionAsync(SaveSegmentationVersionAsyncInDto inDto) { 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(); + + var lastVersion=await _segmentationVersionRepository + .Where(x => x.SegmentationId == inDto.SegmentationId) + .OrderByDescending(x => x.Version) + .FirstOrDefaultAsync(); + + var segmentList = await _segmentRepository + .WhereIf(lastVersion!=null,x=>x.CreateTime<= lastVersion.CreateTime) + .Where(x => x.SegmentationId == inDto.SegmentationId).OrderBy(x=>x.SegmentNumber).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); if (data.SEGUrl != string.Empty&&(inDto.SEGUrl!=data.SEGUrl||inDto.IsRestore)) {