修改
This commit is contained in:
parent
a9d7ab72b2
commit
b21b6402e9
@ -208,6 +208,9 @@ public class TrackPullService : ApplicationService, ITransientDependency
|
|||||||
[HttpPost("UpdateContent")]
|
[HttpPost("UpdateContent")]
|
||||||
public async Task<bool> UpdateContentAsync([FromBody] UpdateTrackPullContentInput input)
|
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) ??
|
var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ??
|
||||||
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
|
||||||
|
|||||||
@ -199,7 +199,7 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
if (input.Options != OptionTypeNoNull.删除)
|
if (input.Options != OptionTypeNoNull.删除)
|
||||||
{
|
{
|
||||||
Expression<Func<TrackPushContentConfigEntity, bool>> isContentAnyExp = x =>
|
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 (input.Options == OptionTypeNoNull.修改) isContentAnyExp = isContentAnyExp.And(x => x.Id != input.Id);
|
||||||
|
|
||||||
if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp))
|
if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp))
|
||||||
|
|||||||
@ -48,4 +48,6 @@ public interface ITrackPullConfigRepository : IBasicRepository<TrackPullConfigEn
|
|||||||
Task<TrackPullContentConfigEntity> GetContentByIdAsync(int id);
|
Task<TrackPullContentConfigEntity> GetContentByIdAsync(int id);
|
||||||
|
|
||||||
Task<bool> UpdateContentAsync(TrackPullContentConfigEntity updateObj);
|
Task<bool> UpdateContentAsync(TrackPullContentConfigEntity updateObj);
|
||||||
|
|
||||||
|
Task<bool> IsContentAnyAsync(Expression<Func<TrackPullContentConfigEntity, bool>> whereExpression);
|
||||||
}
|
}
|
||||||
@ -130,4 +130,9 @@ public class TrackPullConfigRepository : BasicRepository<TrackPullConfigEntity>,
|
|||||||
{
|
{
|
||||||
return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync();
|
return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<bool> IsContentAnyAsync(Expression<Func<TrackPullContentConfigEntity, bool>> whereExpression)
|
||||||
|
{
|
||||||
|
return await Context.Queryable<TrackPullContentConfigEntity>().Where(whereExpression).AnyAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user