Uat_Study
parent
dc0de31164
commit
bed17af3b2
|
@ -202,7 +202,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public Guid SystemCriterionId { get; set; }
|
||||
|
||||
[NotDefault]
|
||||
public string Code { get; set; }
|
||||
public List<string> CodeList { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -80,16 +80,18 @@ namespace IRaCIS.Core.Application.Service.RC
|
|||
[HttpPost]
|
||||
public async Task<IResponseOutput> AddSystemCriterionDictionaryCode(AddSystemCriterionDictionaryCodeInDto inDto)
|
||||
{
|
||||
if (await _systemCriterionDictionaryCodeRepository.AnyAsync(x => x.SystemCriterionId == inDto.SystemCriterionId && x.Code == inDto.Code))
|
||||
{
|
||||
throw new BusinessValidationFailedException("当前标准存在此Code");
|
||||
}
|
||||
|
||||
await _systemCriterionDictionaryCodeRepository.AddAsync(new SystemCriterionDictionaryCode()
|
||||
var codes= await _systemCriterionDictionaryCodeRepository.Where(x => x.SystemCriterionId == inDto.SystemCriterionId).Select(x => x.Code).ToListAsync();
|
||||
|
||||
inDto.CodeList= inDto.CodeList.Except(codes).ToList();
|
||||
|
||||
|
||||
|
||||
await _systemCriterionDictionaryCodeRepository.AddRangeAsync(inDto.CodeList.Select(x=> new SystemCriterionDictionaryCode()
|
||||
{
|
||||
SystemCriterionId = inDto.SystemCriterionId,
|
||||
Code = inDto.Code
|
||||
});
|
||||
Code = x
|
||||
}).ToList());
|
||||
|
||||
await _systemCriterionDictionaryCodeRepository.SaveChangesAsync();
|
||||
|
||||
|
|
Loading…
Reference in New Issue