From 92ca158be8afb6c568613d0adc0c4dc1e7fe2521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 11:11:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9isany?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPull/TrackPullService.cs | 2 +- .../Services/TrackPush/TrackPushService.cs | 8 +++++--- .../Services/TrackTemplates/TrackTemplateService.cs | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index 7f1ad2de..5f9bd451 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -91,7 +91,7 @@ public class TrackPullService : ApplicationService, ITransientDependency Expression> isAnyExp = x => x.SubSystemId == input.SubSystemId && x.TrackTemplateId == input.TrackTemplateId && x.ServiceProviderId == input.ServiceProviderId; - if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id); + if (input.Options == OptionTypeNoNull.修改) isAnyExp = isAnyExp.And(x => x.Id != input.Id); if (await _trackPullConfigRepository.IsAnyAsync(isAnyExp)) throw new BusinessException(message: _stringLocalizer["IsTrackPullConfigAny"]); diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index 85ef0633..0577b1cf 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -104,12 +104,14 @@ public class TrackPushService : ApplicationService, ITransientDependency { Expression> isAnyExp = x => x.SubSystemId == input.SubSystemId && x.CustomId == input.CustomId && x.ServiceProviderId == input.ServiceProviderId; - if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id); + if (input.Options == OptionTypeNoNull.修改) isAnyExp = isAnyExp.And(x => x.Id != input.Id); var trackTemplateIdExp = Expressionable.Create(); foreach (var trackTemplateId in input.TrackTemplateIds) { trackTemplateIdExp.Or(x => SqlFunc.SplitIn(x.TrackTemplateId, trackTemplateId.ToString())); } - if (await _trackPushConfigRepository.IsAnyAsync(isAnyExp.And(trackTemplateIdExp.ToExpression()))) + isAnyExp = isAnyExp.And(trackTemplateIdExp.ToExpression()); + + if (await _trackPushConfigRepository.IsAnyAsync(isAnyExp)) throw new BusinessException(message: _stringLocalizer["IsTrackPushConfigAny"]); } @@ -198,7 +200,7 @@ public class TrackPushService : ApplicationService, ITransientDependency { Expression> isContentAnyExp = x => x.TrackPushConfigId == input.TrackPushConfigId && x.TrackContentId == input.TrackContentId; - if (input.Options == OptionTypeNoNull.修改) isContentAnyExp.And(x => x.Id != input.Id); + if (input.Options == OptionTypeNoNull.修改) isContentAnyExp = isContentAnyExp.And(x => x.Id != input.Id); if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp)) throw new BusinessException(message: _stringLocalizer["IsTrackPushContentAny"]); diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index a250f22b..621ae61a 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -193,11 +193,11 @@ public class TrackTemplateService : ApplicationService, ITransientDependency { if (input.Options != OptionTypeNoNull.删除) { - Expression> isAnyExp = x => + Expression> isContentAnyExp = x => x.TrackTemplateId == input.TrackTemplateId && x.TrackContentId == input.TrackContentId; - if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id); + if (input.Options == OptionTypeNoNull.修改) isContentAnyExp = isContentAnyExp.And(x => x.Id != input.Id); - if (await _trackTemplateRepository.IsContentAnyAsync(isAnyExp)) + if (await _trackTemplateRepository.IsContentAnyAsync(isContentAnyExp)) throw new BusinessException(message: _stringLocalizer["IsTrackTemplateContentAny"]); }