Merge pull request '创建 轨迹内容映射编辑 接口' (#7) from S01-轨迹中台 into dev
Reviewed-on: http://192.168.80.50:3000/Dotnet/SJZY.Track.Api/pulls/7
This commit is contained in:
commit
dbec2f00fd
@ -0,0 +1,41 @@
|
||||
namespace SJZY.Track.Application.Contract.Dtos.TrackContents;
|
||||
|
||||
public class EditTrackContentMapInput
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 映射子系统id
|
||||
/// </summary>
|
||||
public int MapSubSystemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 映射轨迹内容代码
|
||||
/// </summary>
|
||||
public string MapTrackContentCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 映射轨迹内容id
|
||||
/// </summary>
|
||||
public int MapTrackContentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作类型
|
||||
/// </summary>
|
||||
public OptionTypeNoNull Options { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 源子系统id
|
||||
/// </summary>
|
||||
public int SubSystemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 源轨迹内容代码
|
||||
/// </summary>
|
||||
public string TrackContentCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 源轨迹内容id
|
||||
/// </summary>
|
||||
public int TrackContentId { get; set; }
|
||||
}
|
||||
@ -1,9 +1,13 @@
|
||||
using Microsoft.Extensions.Localization;
|
||||
using SJZY.Expand.ABP.Core.Common.Dto;
|
||||
using SJZY.Expand.ABP.Core.Localization;
|
||||
using SJZY.Track.Application.Contract.Dtos.TrackContents;
|
||||
using SJZY.Track.Application.Contract.Dtos.TrackPull;
|
||||
using SJZY.Track.Application.Localization;
|
||||
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||
using SJZY.Track.Domain.Dtos.TrackContents;
|
||||
using System.Linq.Expressions;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
|
||||
namespace SJZY.Track.Application.Services.TrackContents
|
||||
@ -160,5 +164,42 @@ namespace SJZY.Track.Application.Services.TrackContents
|
||||
{
|
||||
return await _trackContentRepository.GetMapDetailAsync(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹内容映射编辑
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("EditMap")]
|
||||
public async Task<bool> EditMapAsync([FromBody] EditTrackContentMapInput input)
|
||||
{
|
||||
if (input.Options != OptionTypeNoNull.删除)
|
||||
{
|
||||
Expression<Func<TrackContentMapEntity, bool>> isMapAnyExp = x =>
|
||||
x.TrackContentId == input.TrackContentId && x.MapTrackContentId == input.MapTrackContentId;
|
||||
if (input.Options == OptionTypeNoNull.修改) isMapAnyExp.And(x => x.Id != input.Id);
|
||||
|
||||
if (await _trackContentRepository.IsMapAnyAsync(isMapAnyExp))
|
||||
throw new BusinessException(message: _stringLocalizer["IsTrackContentMapAny"]);
|
||||
}
|
||||
|
||||
switch (input.Options)
|
||||
{
|
||||
case OptionTypeNoNull.新增:
|
||||
break;
|
||||
|
||||
case OptionTypeNoNull.删除:
|
||||
break;
|
||||
|
||||
case OptionTypeNoNull.修改:
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
|
||||
nameof(EditTrackContentMapInput.Options)]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -11,4 +11,6 @@ public interface ITrackContentRepository : IBasicRepository<TrackContentEntity>
|
||||
Task<UnifyPageResultDto<GetTrackContentMapPageOutputVO>> GetMapPageAsync(GetTrackContentMapPageInputVO input);
|
||||
|
||||
Task<GetTrackContentMapDetailOutputVO> GetMapDetailAsync(int id);
|
||||
|
||||
Task<bool> IsMapAnyAsync(Expression<Func<TrackContentMapEntity, bool>> whereExpression);
|
||||
}
|
||||
@ -43,4 +43,14 @@ public class GetTrackContentMapDetailOutputVO
|
||||
/// 源轨迹内容id
|
||||
/// </summary>
|
||||
public int TrackContentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 源轨迹内容代码
|
||||
/// </summary>
|
||||
public string TrackContentCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 映射轨迹内容代码
|
||||
/// </summary>
|
||||
public string MapTrackContentCode { get; set; }
|
||||
}
|
||||
@ -3,6 +3,7 @@ using SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
||||
using SJZY.Track.Domain.Dtos.TrackContents;
|
||||
using SJZY.Track.Domain.VEntities;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace SJZY.Track.Repository.Repositories;
|
||||
|
||||
@ -138,4 +139,9 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
||||
}, true)
|
||||
.SingleAsync();
|
||||
}
|
||||
|
||||
public async Task<bool> IsMapAnyAsync(Expression<Func<TrackContentMapEntity, bool>> whereExpression)
|
||||
{
|
||||
return await Context.Queryable<TrackContentMapEntity>().Where(whereExpression).AnyAsync();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user