From cbdba985c2e4dd0b45fe7d793d5a9aa668dc4bd2 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 12:07:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AA=8C=E8=AF=81=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=20=E9=A1=B5=E9=9D=A2=20=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=20=E6=98=BE=E7=A4=BA=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE-=E5=88=97=E8=A1=A8=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8C=89=E5=88=9B=E5=BB=BA=E6=97=B6=E9=97=B4=E5=80=92=E5=BA=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackFlags/TrackFlagService.cs | 16 ++++++++-------- .../Repositories/OrderRepository.cs | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs index 01e9acd4..d46b6d96 100644 --- a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs +++ b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs @@ -86,14 +86,13 @@ namespace SJZY.Track.Application.Services.TrackFlags private async Task AddAsync(EditTrackFlagInput input) { #region 业务校验 - - var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => + var trackStatusEntitys = await _trackFlagRepository.GetListAsync(a => a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name == input.Flag)); - if (trackStatusEntity != null) + if (trackStatusEntitys.Any()) { - throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); + //throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); + throw new BusinessException(message: "当前子系统下已存在轨迹标记代码"); } - #endregion var entity = ObjectMapper.Map(input); @@ -106,12 +105,13 @@ namespace SJZY.Track.Application.Services.TrackFlags { #region 业务校验 - var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id != input.Id && + var trackStatusEntitys = await _trackFlagRepository.GetListAsync(a => a.Id != input.Id && a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name == input.Flag)); - if (trackStatusEntity != null) + if (trackStatusEntitys.Any()) { - throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); + //throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); + throw new BusinessException(message: "当前子系统下已存在轨迹标记代码"); } #endregion diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index ac5b7f61..ed618ea4 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -112,6 +112,7 @@ public class OrderRepository : BasicRepository, IOrderRepository, I (a, b, c) => a.CreateTime >= input.CreateTimeStart) .WhereIF((!input.CreateTimeStart.HasValue) && input.CreateTimeEnd.HasValue, (a, b, c) => a.CreateTime <= input.CreateTimeEnd) + .OrderByDescending((a, b, c) => a.CreateTime) .Select((a, b, c) => new TrackOrderVO { Id = a.Id,