修改isany
This commit is contained in:
parent
925bf307b9
commit
92ca158be8
@ -91,7 +91,7 @@ public class TrackPullService : ApplicationService, ITransientDependency
|
||||
Expression<Func<TrackPullConfigEntity, bool>> 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"]);
|
||||
|
||||
@ -104,12 +104,14 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
||||
{
|
||||
Expression<Func<TrackPushConfigEntity, bool>> 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<TrackPushConfigEntity>();
|
||||
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<Func<TrackPushContentConfigEntity, bool>> 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"]);
|
||||
|
||||
@ -193,11 +193,11 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
||||
{
|
||||
if (input.Options != OptionTypeNoNull.删除)
|
||||
{
|
||||
Expression<Func<TrackTemplateContentEntity, bool>> isAnyExp = x =>
|
||||
Expression<Func<TrackTemplateContentEntity, bool>> 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"]);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user