轨迹模版编辑调整

This commit is contained in:
moyongzhen 2024-02-28 16:46:02 +08:00
parent 87cc34b6b0
commit 1b55ad2965
4 changed files with 9 additions and 2 deletions

View File

@ -1,4 +1,5 @@
using AutoMapper;
using AutoMapper.Internal.Mappers;
using SJZY.Track.Application.Dtos.TrackTemplates;
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.TrackTemplate;
@ -17,5 +18,7 @@ public class TrackTemplateAutoMapperProfile : Profile
//CreateMap<UnifyResultDto<GetTrackTemplateDetailVO>, UnifyResultDto<GetTrackTemplateDetailDto>>(MemberList.None);
CreateMap<EditTrackTemplateContentInput, TrackTemplateContentEntity>(MemberList.None);
CreateMap<EditTrackTemplateInput, TrackTemplateEntity>(MemberList.None);
}
}

View File

@ -85,7 +85,7 @@
/// <summary>
/// 模板名称
/// </summary>
public int Name { set; get; }
public string Name { set; get; }
/// <summary>
/// 模板代码

View File

@ -1,4 +1,5 @@
using SJZY.Track.Application.Dtos.TrackContents;
using Microsoft.AspNetCore.Authorization;
using SJZY.Track.Application.Dtos.TrackContents;
using SJZY.Track.Application.Dtos.TrackStatus;
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
using SJZY.Track.Domain.Dtos.TrackContents;
@ -33,6 +34,7 @@ namespace SJZY.Track.Application.Services.TrackContents
/// </summary>
/// <returns></returns>
[HttpPost("Edit")]
[AllowAnonymous]
public async Task<UnifyResultDto> EditAsync(EditTrackContentInput input)
{
return input.Options switch

View File

@ -19,10 +19,12 @@ namespace SJZY.Track.Application.Validations.TrackTemplates
When(x => x.Options == OptionType.新增, () =>
{
RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!");
});
When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () =>
{
RuleFor(x => x.SubSystemId).GreaterThan(0).WithMessage("子系统的id必须大于0!");
RuleFor(x => x.Name).NotNull().WithMessage("模版名称必填!").NotEmpty().WithMessage("模版名称不能为空!");
RuleFor(x => x.Code).NotNull().WithMessage("模版代码必填!").NotEmpty().WithMessage("模版代码不能为空!");
});