完成 轨迹拉取配置内容修改 接口

This commit is contained in:
柳文翔 2024-02-29 17:46:14 +08:00
parent dba6172aab
commit 5ddfaf5ec3
5 changed files with 83 additions and 0 deletions

View File

@ -12,6 +12,7 @@ namespace SJZY.Track.Application.AutoMapper
CreateMap<EditTrackPullConfigInput, TrackPullConfigEntity>(MemberList.None); CreateMap<EditTrackPullConfigInput, TrackPullConfigEntity>(MemberList.None);
CreateMap<EditTrackPullConfigInput, TrackPushPullParamsConfigEntity>(MemberList.None).Ignore(dest => dest.Id) CreateMap<EditTrackPullConfigInput, TrackPushPullParamsConfigEntity>(MemberList.None).Ignore(dest => dest.Id)
.ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false)); .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false));
CreateMap<UpdateTrackPullContentInput, TrackPullContentConfigEntity>(MemberList.None);
} }
} }
} }

View File

@ -0,0 +1,51 @@
namespace SJZY.Track.Application.Dtos.TrackPull;
public class UpdateTrackPullContentInput
{
public int Id { get; set; }
/// <summary>
/// 服务商轨迹代码参数值
/// </summary>
public string TrackContentCodeValue { get; set; }
/// <summary>
/// 轨迹内容id
/// </summary>
public int TrackContentId { get; set; }
/// <summary>
/// 服务商轨迹内容参数值
/// </summary>
public string TrackContentValue { get; set; }
/// <summary>
/// 轨迹关键词(正向)
/// </summary>
public string TrackKeyword { get; set; }
/// <summary>
/// 轨迹关键词(反向)
/// </summary>
public string TrackKeywordReverse { get; set; }
/// <summary>
/// 轨迹发生地参数值
/// </summary>
public int? TrackPlaceValue { get; set; }
/// <summary>
/// 轨迹拉取配置id
/// </summary>
public int TrackPullConfigId { get; set; }
/// <summary>
/// 服务商轨迹状态参数值
/// </summary>
public string TrackStatusValue { get; set; }
/// <summary>
/// 轨迹时区GMT
/// </summary>
public string TrackTimeZone { get; set; }
}

View File

@ -188,4 +188,21 @@ public class TrackPullService : ApplicationService, ITransientDependency
return true; return true;
} }
/// <summary>
/// 轨迹拉取配置内容修改
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("UpdateContent")]
public async Task<bool> UpdateContentAsync([FromBody] UpdateTrackPullContentInput input)
{
var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
ObjectMapper.Map(input, oldTrackPullContentEntity);
await _trackPullConfigRepository.UpdateContentAsync(oldTrackPullContentEntity);
return true;
}
} }

View File

@ -44,4 +44,8 @@ public interface ITrackPullConfigRepository : IBasicRepository<TrackPullConfigEn
Task<bool> SoftDeleteContentAsync(Expression<Func<TrackPullContentConfigEntity, bool>> whereExpression); Task<bool> SoftDeleteContentAsync(Expression<Func<TrackPullContentConfigEntity, bool>> whereExpression);
Task<bool> SoftDeleteParamsAsync(Expression<Func<TrackPushPullParamsConfigEntity, bool>> whereExpression); Task<bool> SoftDeleteParamsAsync(Expression<Func<TrackPushPullParamsConfigEntity, bool>> whereExpression);
Task<TrackPullContentConfigEntity> GetContentByIdAsync(int id);
Task<bool> UpdateContentAsync(TrackPullContentConfigEntity updateObj);
} }

View File

@ -120,4 +120,14 @@ public class TrackPullConfigRepository : BasicRepository<TrackPullConfigEntity>,
.SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true) .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true)
.ExecuteCommandHasChangeAsync(); .ExecuteCommandHasChangeAsync();
} }
public async Task<TrackPullContentConfigEntity> GetContentByIdAsync(int id)
{
return await Context.Queryable<TrackPullContentConfigEntity>().InSingleAsync(id);
}
public async Task<bool> UpdateContentAsync(TrackPullContentConfigEntity updateObj)
{
return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync();
}
} }