Merge pull request 'S01-轨迹中台' (#19) from S01-轨迹中台 into dev

Reviewed-on: http://192.168.80.50:3000/Dotnet/SJZY.Track.Api/pulls/19
This commit is contained in:
liuwenxiang 2024-03-02 12:43:44 +08:00
commit 4813d880a9
4 changed files with 11 additions and 1 deletions

View File

@ -208,6 +208,9 @@ public class TrackPullService : ApplicationService, ITransientDependency
[HttpPost("UpdateContent")]
public async Task<bool> UpdateContentAsync([FromBody] UpdateTrackPullContentInput input)
{
if (await _trackPullConfigRepository.IsContentAnyAsync(x => x.Id != input.Id && x.TrackPullConfigId == input.TrackPullConfigId && (x.TrackContentId == input.TrackContentId || x.TrackContentCodeValue == input.TrackContentCodeValue || x.TrackStatusValue == input.TrackStatusValue || x.TrackContentValue == input.TrackContentValue || x.TrackKeyword == input.TrackKeyword)))
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentAny"]);
var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ??
throw new BusinessException(message: _stringLocalizer["NotFindData"]);

View File

@ -199,7 +199,7 @@ public class TrackPushService : ApplicationService, ITransientDependency
if (input.Options != OptionTypeNoNull.删除)
{
Expression<Func<TrackPushContentConfigEntity, bool>> isContentAnyExp = x =>
x.TrackPushConfigId == input.TrackPushConfigId && x.TrackContentId == input.TrackContentId;
x.TrackPushConfigId == input.TrackPushConfigId && (x.TrackContentId == input.TrackContentId || x.TrackContentCodeValue == input.TrackContentCodeValue || x.TrackStatusValue == x.TrackStatusValue || x.TrackContentValue == input.TrackContentValue || x.TrackEnContentValue == input.TrackEnContentValue);
if (input.Options == OptionTypeNoNull.修改) isContentAnyExp = isContentAnyExp.And(x => x.Id != input.Id);
if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp))

View File

@ -48,4 +48,6 @@ public interface ITrackPullConfigRepository : IBasicRepository<TrackPullConfigEn
Task<TrackPullContentConfigEntity> GetContentByIdAsync(int id);
Task<bool> UpdateContentAsync(TrackPullContentConfigEntity updateObj);
Task<bool> IsContentAnyAsync(Expression<Func<TrackPullContentConfigEntity, bool>> whereExpression);
}

View File

@ -130,4 +130,9 @@ public class TrackPullConfigRepository : BasicRepository<TrackPullConfigEntity>,
{
return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync();
}
public async Task<bool> IsContentAnyAsync(Expression<Func<TrackPullContentConfigEntity, bool>> whereExpression)
{
return await Context.Queryable<TrackPullContentConfigEntity>().Where(whereExpression).AnyAsync();
}
}