diff --git a/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs b/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs
new file mode 100644
index 00000000..87cc3632
--- /dev/null
+++ b/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SJZY.Track.Application.Dtos.TrackContents
+{
+ public class EditTrackContentInput
+ {
+ ///
+ /// Id
+ ///
+ public int Id { get; set; }
+
+ ///
+ /// 操作类型
+ ///
+ public OptionType Options { get; set; }
+
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 所属轨迹状态id
+ ///
+ public int TrackStatusId { get; set; }
+
+ ///
+ /// 轨迹内容代码
+ ///
+ public string Code { get; set; }
+
+ ///
+ /// 轨迹内容
+ ///
+ public string Content { get; set; }
+
+ ///
+ /// 轨迹内容英文
+ ///
+ public string EnContent { get; set; }
+
+ ///
+ /// 轨迹标记id
+ ///
+ public int TrackFlagId { get; set; }
+ }
+}
diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs
index a96b960c..dc5c40c2 100644
--- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs
+++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs
@@ -1,4 +1,7 @@
-using System;
+using SJZY.Track.Application.Dtos.TrackContents;
+using SJZY.Track.Application.Dtos.TrackStatus;
+using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,16 +10,62 @@ using Volo.Abp.DependencyInjection;
namespace SJZY.Track.Application.Services.TrackContents
{
+ ///
+ /// 轨迹内容服务
+ ///
[ApiExplorerSettings(GroupName = "轨迹内容")]
[Route("/Track/Content")]
public class TrackContentService : ApplicationService, ITransientDependency
{
+ private readonly ITrackContentRepository _trackContentRepository;
- public TrackContentService()
+ public TrackContentService(
+ ITrackContentRepository trackContentRepository
+ )
{
-
+ this._trackContentRepository=trackContentRepository;
}
+ ///
+ /// 轨迹内容编辑
+ ///
+ ///
+ [HttpPost("Edit")]
+ public async Task EditAsync(EditTrackContentInput input)
+ {
+ return input.Options switch
+ {
+ OptionType.新增 => await AddAsync(input),
+ OptionType.修改 => await UpdateAsync(input),
+ OptionType.删除 => await DeleteAsync(input),
+ _ => throw new BusinessException(message: "当前操作动作不合法")
+ };
+ }
+ #region 私有方法
+ private async Task AddAsync(EditTrackContentInput input)
+ {
+ var entity = ObjectMapper.Map(input);
+ var isTrue = await _trackContentRepository.InsertAsync(entity);
+
+ return new UnifyResultDto("200", "新增成功", isTrue);
+ }
+
+ private async Task UpdateAsync(EditTrackContentInput input)
+ {
+ var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id);
+ ObjectMapper.Map(input, templateEntity);
+ var isTrue = await _trackContentRepository.UpdateAsync(templateEntity);
+
+ return new UnifyResultDto("200", "修改成功", isTrue);
+ }
+
+ private async Task DeleteAsync(EditTrackContentInput input)
+ {
+ var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id);
+
+ return new UnifyResultDto("200", "删除成功", isTrue);
+ }
+ #endregion
}
}