fix:添加模版存在性校验

This commit is contained in:
xiaolipro 2024-09-24 16:42:42 +08:00
parent 693dff47be
commit bb57b8711a

View File

@ -259,6 +259,11 @@ public class TrackTemplateService : ApplicationService
#endregion 业务校验 #endregion 业务校验
var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.Id == input.Id); var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.Id == input.Id);
if (templateEntity == null)
{
throw new BusinessException(message: "模版不存在");
}
ObjectMapper.Map(input, templateEntity); ObjectMapper.Map(input, templateEntity);
var isTrue = await _trackTemplateRepository.UpdateAsync(templateEntity); var isTrue = await _trackTemplateRepository.UpdateAsync(templateEntity);