Uat_Study
parent
8ab0ec0fcc
commit
8c093427e2
|
@ -61,11 +61,11 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
var existsQuery = _readingMedicineSystemQuestionRepository
|
||||
.WhereIf(inDto.Id != null, x => x.Id != inDto.Id)
|
||||
.Where(x => x.QuestionName == inDto.QuestionName ||x.ShowOrder == inDto.ShowOrder);
|
||||
.Where(x =>x.ShowOrder == inDto.ShowOrder);
|
||||
|
||||
if (await existsQuery.AnyAsync())
|
||||
{
|
||||
return ResponseOutput.NotOk("当前问题名称或序号存在重复");
|
||||
return ResponseOutput.NotOk("当前问题序号存在重复");
|
||||
}
|
||||
var entity = await _readingMedicineSystemQuestionRepository.InsertOrUpdateAsync(inDto);
|
||||
await _readingMedicineSystemQuestionRepository.SaveChangesAsync();
|
||||
|
@ -162,11 +162,11 @@ namespace IRaCIS.Core.Application.Service
|
|||
var existsQuery = _readingMedicineTrialQuestionRepository
|
||||
.WhereIf(inDto.Id != null, x => x.Id != inDto.Id)
|
||||
.Where(x => x.TrialId==inDto.TrialId)
|
||||
.Where(x => x.QuestionName == inDto.QuestionName || x.ShowOrder == inDto.ShowOrder);
|
||||
.Where(x => x.ShowOrder == inDto.ShowOrder);
|
||||
|
||||
if (await existsQuery.AnyAsync())
|
||||
{
|
||||
return ResponseOutput.NotOk("当前问题名称或序号存在重复");
|
||||
return ResponseOutput.NotOk("当前问题序号存在重复");
|
||||
}
|
||||
var entity = await _readingMedicineTrialQuestionRepository.InsertOrUpdateAsync(inDto);
|
||||
await _readingMedicineTrialQuestionRepository.SaveChangesAsync();
|
||||
|
@ -213,10 +213,14 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
// 直接写??
|
||||
var systemList = await _readingMedicineSystemQuestionRepository.Where(x => inDto.SystemQuestionIds.Contains(x.Id)).ToListAsync();
|
||||
var needList= systemList.Select(x => new ReadingMedicineTrialQuestion()
|
||||
|
||||
var maxOrder = await _readingMedicineTrialQuestionRepository.Where(x => x.TrialId == inDto.TrialId).OrderByDescending(x => x.ShowOrder).Select(x => x.ShowOrder).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
var needList= systemList.Select(x => new ReadingMedicineTrialQuestion()
|
||||
{
|
||||
Id = NewId.NextGuid(),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ShowOrder = maxOrder++,
|
||||
IsEnable = x.IsEnable,
|
||||
IsRequired = x.IsRequired,
|
||||
QuestionName = x.QuestionName,
|
||||
|
@ -226,6 +230,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
TrialId=inDto.TrialId,
|
||||
}).ToList();
|
||||
|
||||
|
||||
|
||||
await _readingMedicineTrialQuestionRepository.AddRangeAsync(needList);
|
||||
var result = await _readingMedicineTrialQuestionRepository.SaveChangesAsync();
|
||||
return ResponseOutput.Result(result);
|
||||
|
|
Loading…
Reference in New Issue