Uat_Study
parent
8ab0ec0fcc
commit
8c093427e2
|
@ -61,11 +61,11 @@ namespace IRaCIS.Core.Application.Service
|
||||||
{
|
{
|
||||||
var existsQuery = _readingMedicineSystemQuestionRepository
|
var existsQuery = _readingMedicineSystemQuestionRepository
|
||||||
.WhereIf(inDto.Id != null, x => x.Id != inDto.Id)
|
.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())
|
if (await existsQuery.AnyAsync())
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk("当前问题名称或序号存在重复");
|
return ResponseOutput.NotOk("当前问题序号存在重复");
|
||||||
}
|
}
|
||||||
var entity = await _readingMedicineSystemQuestionRepository.InsertOrUpdateAsync(inDto);
|
var entity = await _readingMedicineSystemQuestionRepository.InsertOrUpdateAsync(inDto);
|
||||||
await _readingMedicineSystemQuestionRepository.SaveChangesAsync();
|
await _readingMedicineSystemQuestionRepository.SaveChangesAsync();
|
||||||
|
@ -162,11 +162,11 @@ namespace IRaCIS.Core.Application.Service
|
||||||
var existsQuery = _readingMedicineTrialQuestionRepository
|
var existsQuery = _readingMedicineTrialQuestionRepository
|
||||||
.WhereIf(inDto.Id != null, x => x.Id != inDto.Id)
|
.WhereIf(inDto.Id != null, x => x.Id != inDto.Id)
|
||||||
.Where(x => x.TrialId==inDto.TrialId)
|
.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())
|
if (await existsQuery.AnyAsync())
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk("当前问题名称或序号存在重复");
|
return ResponseOutput.NotOk("当前问题序号存在重复");
|
||||||
}
|
}
|
||||||
var entity = await _readingMedicineTrialQuestionRepository.InsertOrUpdateAsync(inDto);
|
var entity = await _readingMedicineTrialQuestionRepository.InsertOrUpdateAsync(inDto);
|
||||||
await _readingMedicineTrialQuestionRepository.SaveChangesAsync();
|
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 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(),
|
Id = NewId.NextGuid(),
|
||||||
ShowOrder = x.ShowOrder,
|
ShowOrder = maxOrder++,
|
||||||
IsEnable = x.IsEnable,
|
IsEnable = x.IsEnable,
|
||||||
IsRequired = x.IsRequired,
|
IsRequired = x.IsRequired,
|
||||||
QuestionName = x.QuestionName,
|
QuestionName = x.QuestionName,
|
||||||
|
@ -226,6 +230,8 @@ namespace IRaCIS.Core.Application.Service
|
||||||
TrialId=inDto.TrialId,
|
TrialId=inDto.TrialId,
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await _readingMedicineTrialQuestionRepository.AddRangeAsync(needList);
|
await _readingMedicineTrialQuestionRepository.AddRangeAsync(needList);
|
||||||
var result = await _readingMedicineTrialQuestionRepository.SaveChangesAsync();
|
var result = await _readingMedicineTrialQuestionRepository.SaveChangesAsync();
|
||||||
return ResponseOutput.Result(result);
|
return ResponseOutput.Result(result);
|
||||||
|
|
Loading…
Reference in New Issue