diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml index a5327ba4..a24f77d5 100644 --- a/Tiobon.Core.Api/Tiobon.Core.Model.xml +++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml @@ -4957,6 +4957,11 @@ 题目类型 + + + 题目内容 + + 试卷配置ID diff --git a/Tiobon.Core.Model/Base/Ghre/Ghre_ExamPaperConfig.Dto.Base.cs b/Tiobon.Core.Model/Base/Ghre/Ghre_ExamPaperConfig.Dto.Base.cs index 143e4a62..5df7acdf 100644 --- a/Tiobon.Core.Model/Base/Ghre/Ghre_ExamPaperConfig.Dto.Base.cs +++ b/Tiobon.Core.Model/Base/Ghre/Ghre_ExamPaperConfig.Dto.Base.cs @@ -59,7 +59,7 @@ namespace Tiobon.Core.Model.Models /// /// 题目内容ID /// - [Display(Name = "QuestionContent"), Description("题目内容ID"), MaxLength(2000, ErrorMessage = "题目内容 不能超过 2000 个字符")] + [Display(Name = "QuestionId"), Description("题目内容ID")] public long? QuestionId { get; set; } /// diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamPaperServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamPaperServices.cs index fd90bf4c..414be127 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamPaperServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamPaperServices.cs @@ -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(); 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(sql); @@ -435,11 +441,12 @@ namespace Tiobon.Core.Services var insert = new InsertGhre_ExamPaperInput(); insert = Mapper.Map(insertModel.baseData).ToANew(); - 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>();