From 4d84e4283aeba217ab14d952458d4189a95de8ac Mon Sep 17 00:00:00 2001 From: xiaolipro <2357729423@qq.com> Date: Wed, 25 Sep 2024 15:09:11 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E6=9F=A5=E8=AF=A2=E5=88=B0?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E5=88=A0=E9=99=A4=E7=9A=84=E6=8B=89=E5=8F=96?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPull/TrackPullService.cs | 11 +++++++++-- .../Repositories/TrackPullConfigRepository.cs | 9 +++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index 48fe3dbf..6e8c44bd 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -66,9 +66,16 @@ public class TrackPullService : ApplicationService /// /// [HttpGet("GetDetail")] - public async Task GetDetailAsync(int id) + public async Task GetDetailAsync(int id) { - return await _trackPullConfigRepository.GetDetailAsync(id); + var res = await _trackPullConfigRepository.GetDetailAsync(id); + + if (res == null) + { + throw new BusinessException(message: "轨迹拉取配置不存在"); + } + + return res; } /// diff --git a/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs index 49e4d489..5135b843 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs @@ -15,12 +15,9 @@ public class TrackPullConfigRepository : BasicRepository, { public async Task> GetPageAsync(KeywordsInputVO input) { - return await AsQueryable() - .LeftJoin((trackPull, system) => trackPull.SubSystemId == system.Id && !system.IsDeleted) - .LeftJoin((trackPull, system, service) => - trackPull.ServiceProviderId == service.Id && !service.IsDeleted) - .Filter(null, true) - .Where(trackPull => !trackPull.IsDeleted) + return await Context.Queryable() + .LeftJoin((trackPull, system) => trackPull.SubSystemId == system.Id) + .LeftJoin((trackPull, system, service) => trackPull.ServiceProviderId == service.Id) .WhereIF(input.SubSystemId.HasValue, trackPull => trackPull.SubSystemId == input.SubSystemId) .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (trackPull, system, service) => service.Name.Contains(input.Keywords!))