|
|
|
@ -316,7 +316,7 @@ namespace Tiobon.Core.Services |
|
|
|
|
ConfigId = x.ConfigId, |
|
|
|
|
parentId = x.ConfigId, |
|
|
|
|
QuestionId = x.QuestionId.Value, |
|
|
|
|
ExamPaperId = x.ExamPaperId, |
|
|
|
|
ExamPaperId = x.ExamPaperId |
|
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
|
|
var questionIds = previews.Select(x => x.QuestionId).Distinct().ToList(); |
|
|
|
@ -326,7 +326,8 @@ namespace Tiobon.Core.Services |
|
|
|
|
previews.ForEach(x => |
|
|
|
|
{ |
|
|
|
|
var answers1 = answers.Where(y => y.QuestionId == x.QuestionId).ToList(); |
|
|
|
|
|
|
|
|
|
x.QuestionType = questions1.FirstOrDefault(a=>a.Id==x.QuestionId)?.QuestionType; |
|
|
|
|
x.QuestionContent = questions1.FirstOrDefault(a=>a.Id==x.QuestionId)?.QuestionContent; |
|
|
|
|
|
|
|
|
|
//var detail = questions1.Select(o => |
|
|
|
|
//new FromGhre_QuestionQuestionTypeDetail() |
|
|
|
@ -381,6 +382,9 @@ namespace Tiobon.Core.Services |
|
|
|
|
long parentId = SnowFlakeSingle.instance.getID(); |
|
|
|
|
input.tableData = Mapper.Map(insert).ToANew<Ghre_ExamPaperConfig>(); |
|
|
|
|
input.tableData.Id = parentId; |
|
|
|
|
|
|
|
|
|
if (insert.QuestionId != null) |
|
|
|
|
insert.Quantity = 1; |
|
|
|
|
string sql = $@"SELECT TOP {insert.Quantity} *,NEWID() AS GuidValue FROM Ghre_Question WHERE IsEnable=1"; |
|
|
|
|
if (!string.IsNullOrWhiteSpace(insert.DifficultyLevel)) |
|
|
|
|
sql += $" AND DifficultyLevel='{insert.DifficultyLevel}'"; |
|
|
|
@ -388,6 +392,8 @@ namespace Tiobon.Core.Services |
|
|
|
|
sql += $" AND QuestionType='{insert.QuestionType}'"; |
|
|
|
|
if (insert.CourseId != null) |
|
|
|
|
sql += $" AND CourseId='{insert.CourseId}'"; |
|
|
|
|
if (insert.CourseId != null) |
|
|
|
|
sql += $" AND Id='{insert.QuestionId}'"; |
|
|
|
|
sql += $" ORDER BY GuidValue ASC"; |
|
|
|
|
var questions = await Db.Ado.SqlQueryAsync<Ghre_Question>(sql); |
|
|
|
|
|
|
|
|
@ -435,11 +441,12 @@ namespace Tiobon.Core.Services |
|
|
|
|
var insert = new InsertGhre_ExamPaperInput(); |
|
|
|
|
|
|
|
|
|
insert = Mapper.Map(insertModel.baseData).ToANew<InsertGhre_ExamPaperInput>(); |
|
|
|
|
insert.PaperNo = await GenerateContinuousSequence("Ghre_ExamPaper", "P", "PaperNo"); |
|
|
|
|
insert.PaperNo = await GenerateContinuousSequence("Ghre_ExamPaper", "PaperNo", "P"); |
|
|
|
|
insert.LinkId = insertModel.baseData.LinkType == "CourseId" ? insertModel.baseData.CourseId : insertModel.baseData.CourseSceneId; |
|
|
|
|
insert.CoverUrl = insertModel.styleInfo.coverImage; |
|
|
|
|
insert.Style = insertModel.styleInfo.paperStyle; |
|
|
|
|
insert.ScoreMethod = insertModel.examPaperSetType; |
|
|
|
|
insert.Status = "Draft"; |
|
|
|
|
|
|
|
|
|
var id = await Add(insert); |
|
|
|
|
var configs = Mapper.Map(insertModel.examPaperSetData).ToANew<List<Ghre_ExamPaperConfig>>(); |
|
|
|
|