diff --git a/Tiobon.Core.Api/Controllers/CommonController.cs b/Tiobon.Core.Api/Controllers/CommonController.cs
index 77c37b23..72d26edc 100644
--- a/Tiobon.Core.Api/Controllers/CommonController.cs
+++ b/Tiobon.Core.Api/Controllers/CommonController.cs
@@ -55,7 +55,7 @@ public class CommonController : BaseApiController
///
///
///
- [HttpPost, Route("GetSelect")]
+ [HttpPost, Route("GetSelect/{type}")]
public async Task> GetSelectAsync(string type)
{
return await _commonServices.GetSelectAsync(type);
diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamPaperController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamPaperController.cs
index 8be1990c..4eee3d51 100644
--- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamPaperController.cs
+++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamPaperController.cs
@@ -27,6 +27,20 @@ public class Ghre_ExamPaperController : BaseController
+ /// 新增配置数据
+ ///
+ ///
+ ///
+ [HttpPost("InsertConfig")]
+ public async Task> InsertConfig(InsertGhre_ExamPaperConfigInput insert)
+ {
+ return await _service.InsertConfig(insert);
+ }
+ #endregion
+
#endregion
diff --git a/Tiobon.Core.IServices/Ghre/IGhre_ExamPaperServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_ExamPaperServices.cs
index b2cd88b7..7ed86c4d 100644
--- a/Tiobon.Core.IServices/Ghre/IGhre_ExamPaperServices.cs
+++ b/Tiobon.Core.IServices/Ghre/IGhre_ExamPaperServices.cs
@@ -10,5 +10,7 @@ namespace Tiobon.Core.IServices
public interface IGhre_ExamPaperServices :IBaseServices
{
Task> QueryDefault(long Id);
+
+ Task> InsertConfig(InsertGhre_ExamPaperConfigInput insert);
}
}
\ No newline at end of file
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 d8100101..143e4a62 100644
--- a/Tiobon.Core.Model/Base/Ghre/Ghre_ExamPaperConfig.Dto.Base.cs
+++ b/Tiobon.Core.Model/Base/Ghre/Ghre_ExamPaperConfig.Dto.Base.cs
@@ -30,10 +30,14 @@ namespace Tiobon.Core.Model.Models
///
/// 试卷ID
///
+ [Display(Name = "ExamPaperId"), Description("试卷ID")]
+ public long? ExamPaperId { get; set; }
///
/// 课程ID
///
+ [Display(Name = "CourseId"), Description("课程ID")]
+ public long? CourseId { get; set; }
///
/// 排序号
@@ -53,10 +57,10 @@ namespace Tiobon.Core.Model.Models
public string QuestionType { get; set; }
///
- /// 题目内容
+ /// 题目内容ID
///
- [Display(Name = "QuestionContent"), Description("题目内容"), MaxLength(2000, ErrorMessage = "题目内容 不能超过 2000 个字符")]
- public string QuestionContent { get; set; }
+ [Display(Name = "QuestionContent"), Description("题目内容ID"), MaxLength(2000, ErrorMessage = "题目内容 不能超过 2000 个字符")]
+ public long? QuestionId { get; set; }
///
/// 数量
diff --git a/Tiobon.Core.Model/Models/Ghre/Ghre_ExamPaperConfig.cs b/Tiobon.Core.Model/Models/Ghre/Ghre_ExamPaperConfig.cs
index f0dbb73b..b327dfdf 100644
--- a/Tiobon.Core.Model/Models/Ghre/Ghre_ExamPaperConfig.cs
+++ b/Tiobon.Core.Model/Models/Ghre/Ghre_ExamPaperConfig.cs
@@ -6,7 +6,7 @@
*
* Ver 变更日期 负责人 变更内容
* ───────────────────────────────────
-*V0.01 2024/5/13 11:28:39 SimonHsiao 初版
+*V0.01 2024/5/13 13:43:22 SimonHsiao 初版
*
* Copyright(c) 2024 Tiobon Corporation. All Rights Reserved.
*┌──────────────────────────────────┐
@@ -57,10 +57,9 @@ namespace Tiobon.Core.Model.Models
public string QuestionType { get; set; }
///
- /// 题目内容
+ /// 题目内容ID
///
- [Display(Name = "QuestionContent"), Description("题目内容"), MaxLength(2000, ErrorMessage = "题目内容 不能超过 2000 个字符")]
- public string QuestionContent { get; set; }
+ public long? QuestionId { get; set; }
///
/// 数量
diff --git a/Tiobon.Core.Model/ViewModels/Extend/DefaultGhre_ExamPaperInput.cs b/Tiobon.Core.Model/ViewModels/Extend/DefaultGhre_ExamPaperInput.cs
index 0e0e6a15..2c647c16 100644
--- a/Tiobon.Core.Model/ViewModels/Extend/DefaultGhre_ExamPaperInput.cs
+++ b/Tiobon.Core.Model/ViewModels/Extend/DefaultGhre_ExamPaperInput.cs
@@ -1,8 +1,5 @@
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel;
-using System.Dynamic;
+using System.Dynamic;
using Tiobon.Core.Model.Models;
-using static System.Runtime.InteropServices.JavaScript.JSType;
namespace Tiobon.Core.Model;
@@ -62,4 +59,10 @@ public class DefaultGhre_ExamPaperPreview
///
public long? ConfigId { get; set; }
public List detail { get; set; } = new List { };
+}
+public class InsertExamPaperConfigInput
+{
+ public Ghre_ExamPaperConfig tableData { get; set; } = new Ghre_ExamPaperConfig();
+ public List previewList { get; set; } = new List { };
+
}
\ No newline at end of file
diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs
index 9923830d..8beb81db 100644
--- a/Tiobon.Core.Services/CommonServices.cs
+++ b/Tiobon.Core.Services/CommonServices.cs
@@ -109,13 +109,13 @@ public partial class CommonServices : BaseServices>, ICommon
//UNION ALL
- //UNION ALL
- // SELECT NULL fnKeySeq,
- // 'DataSort' fnKey,
- // 'GHR_Common_000045' fnTitle,
- // 'table',
- // 'left',
- // 'ghr-data-sort'
+ //UNION ALL
+ // SELECT NULL fnKeySeq,
+ // 'DataSort' fnKey,
+ // 'GHR_Common_000045' fnTitle,
+ // 'table',
+ // 'left',
+ // 'ghr-data-sort'
#region 定义页面的操作按钮
string sql = @"SELECT fnKey,
@@ -279,7 +279,8 @@ public partial class CommonServices : BaseServices>, ICommon
if (toolbar != null) { toolbar.fnKey = "TBD1YN"; }
toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "UpdateYN").FirstOrDefault();
if (toolbar != null) { toolbar.fnKey = "TBD2YN"; }
- }else if (param.menuName == "F_ExamPaperDraft")
+ }
+ else if (param.menuName == "F_ExamPaperDraft")
{
var toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "NewYN").FirstOrDefault();
if (toolbar != null) { toolbar.fnKey = "TBD1YN"; }
@@ -319,7 +320,7 @@ public partial class CommonServices : BaseServices>, ICommon
AND a.UserID = '{1}'
AND a.IsEnable = 1
AND a.PageSettingQueryId = b.PageSettingQueryId";
- sql = string.Format(sql, param.menuName, App.User.ID, param.langId);
+ sql = string.Format(sql, param.menuName, App.User.ID, param.langId);
int UserHasSetting = Db.Ado.GetInt(sql);
if (UserHasSetting == 0)
{
@@ -1049,41 +1050,120 @@ public partial class CommonServices : BaseServices>, ICommon
JArray TableColumn = new JArray();
JArray DT_TablePageInfoT1 = new JArray();
JArray DT_TableDataT1 = new JArray();
- if (type == "Ghre_Course")
+ JObject searchItem = new JObject();
+ JObject item;
+ DataTable dt;
+ string sql;
+ switch (type)
{
- JObject searchItem = [
- new JProperty("defaultHidden", true),
+ case "Ghre_Course":
+ searchItem = [
+ new JProperty("defaultHidden", true),
new JProperty("field","value"),
new JProperty("label","课程ID"),
];
- TableColumn.Add(searchItem);
- searchItem = [
- new JProperty("field","label"),
+ TableColumn.Add(searchItem);
+ searchItem = [
+ new JProperty("field","label"),
new JProperty("label","课程编号"),
];
- TableColumn.Add(searchItem);
+ TableColumn.Add(searchItem);
- string sql = "SELECT Id, CourseNo, CourseName FROM Ghre_Course";
- DataTable dt = await Db.Ado.GetDataTableAsync(sql);
+ sql = "SELECT Id, CourseNo, CourseName FROM Ghre_Course";
+ dt = await Db.Ado.GetDataTableAsync(sql);
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- JObject item = [
- new JProperty("value",long.Parse(dt.Rows[i]["Id"].ToString())),
- new JProperty("label",dt.Rows[i]["CourseNo"].ToString()+"-"+dt.Rows[i]["CourseName"].ToString())
- ];
- DT_TableDataT1.Add(item);
- }
+ for (int i = 0; i < dt.Rows.Count; i++)
+ {
+ item = [
+ new JProperty("value",long.Parse(dt.Rows[i]["Id"].ToString())),
+ new JProperty("label",dt.Rows[i]["CourseNo"].ToString()+"-"+dt.Rows[i]["CourseName"].ToString())
+ ];
+ DT_TableDataT1.Add(item);
+ }
+
+ item = [
+ new JProperty("ListMax",100),
+ new JProperty("ListMin",10),
+ new JProperty("PageNum",1),
+ new JProperty("PageSize",99999),
+ new JProperty("TotalCount",dt.Rows.Count),
+ new JProperty("UIType","Auto")
+ ];
+ DT_TablePageInfoT1.Add(item);
+ break;
+ case "Ghre_CourseScene":
+ searchItem = [
+ new JProperty("defaultHidden", true),
+ new JProperty("field","value"),
+ new JProperty("label","场景ID"),
+ ];
+ TableColumn.Add(searchItem);
+ searchItem = [
+ new JProperty("field","label"),
+ new JProperty("label","场景"),
+ ];
+ TableColumn.Add(searchItem);
+
+ sql = "SELECT Id, SceneNo, SceneName FROM Ghre_CourseScene";
+ dt = await Db.Ado.GetDataTableAsync(sql);
- JObject item1 = [
+ for (int i = 0; i < dt.Rows.Count; i++)
+ {
+ item = [
+ new JProperty("value",long.Parse(dt.Rows[i]["Id"].ToString())),
+ new JProperty("label",dt.Rows[i]["SceneNo"].ToString()+"-"+dt.Rows[i]["SceneName"].ToString())
+ ];
+ DT_TableDataT1.Add(item);
+ }
+
+ item = [
new JProperty("ListMax",100),
new JProperty("ListMin",10),
new JProperty("PageNum",1),
new JProperty("PageSize",99999),
new JProperty("TotalCount",dt.Rows.Count),
new JProperty("UIType","Auto")
- ];
- DT_TablePageInfoT1.Add(item1);
+ ];
+ DT_TablePageInfoT1.Add(item);
+ break;
+ case "ScoreMethod":
+ searchItem = [
+ new JProperty("defaultHidden", true),
+ new JProperty("field","value"),
+ new JProperty("label","value"),
+ ];
+ TableColumn.Add(searchItem);
+ searchItem = [
+ new JProperty("field","label"),
+ new JProperty("label","label"),
+ ];
+ TableColumn.Add(searchItem);
+
+ sql = "SELECT Id, CourseNo, CourseName FROM Ghre_Course";
+ dt = await Db.Ado.GetDataTableAsync(sql);
+
+ item = [
+ new JProperty("value","Manual"),
+ new JProperty("label","人工评分")
+ ];
+ DT_TableDataT1.Add(item);
+ item = [
+ new JProperty("value","System"),
+ new JProperty("label","系统评分")
+ ];
+ DT_TableDataT1.Add(item);
+
+ item = [
+ new JProperty("ListMax",100),
+ new JProperty("ListMin",10),
+ new JProperty("PageNum",1),
+ new JProperty("PageSize",99999),
+ new JProperty("TotalCount",dt.Rows.Count),
+ new JProperty("UIType","Auto")
+ ];
+ DT_TablePageInfoT1.Add(item);
+ break;
+
}
result.JM_TableColumnT1.TableColumn = TableColumn;
result.DT_TableDataT1 = DT_TableDataT1;
diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamPaperServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamPaperServices.cs
index 90ce739f..876322fa 100644
--- a/Tiobon.Core.Services/Ghre/Ghre_ExamPaperServices.cs
+++ b/Tiobon.Core.Services/Ghre/Ghre_ExamPaperServices.cs
@@ -1,11 +1,13 @@
+using System.Dynamic;
+using AgileObjects.AgileMapper;
+using SqlSugar;
+using Tiobon.Core.Common.DB.Dapper.Extensions;
+using Tiobon.Core.IRepository.Base;
using Tiobon.Core.IServices;
+using Tiobon.Core.Model;
using Tiobon.Core.Model.Models;
using Tiobon.Core.Services.BASE;
-using Tiobon.Core.IRepository.Base;
-using Tiobon.Core.Model;
-using System.Dynamic;
-using System.ComponentModel.DataAnnotations;
namespace Tiobon.Core.Services
{
@@ -76,6 +78,7 @@ namespace Tiobon.Core.Services
required = true,
multipleSelect = false,
editable = true,
+ dataSource = "api/Common/GetSelect/ScoreMethod"
},
new DefaultGhre_ExamPaperColumn()
{
@@ -108,7 +111,7 @@ namespace Tiobon.Core.Services
{
label = "试卷说明",
field = "RemarkSz",
- elementType = "TextArea",
+ elementType = "InputTextArea",
required = false,
multipleSelect = false,
editable = true,
@@ -130,6 +133,7 @@ namespace Tiobon.Core.Services
required = false,
multipleSelect = false,
editable = true,
+ dataSource = "api/Common/GetSelect/Ghre_Course"
},
new DefaultGhre_ExamPaperColumn()
{
@@ -139,6 +143,7 @@ namespace Tiobon.Core.Services
required = false,
multipleSelect = false,
editable = true,
+ dataSource = "api/Common/GetSelect/Ghre_CourseScene"
}
};
#endregion
@@ -256,7 +261,25 @@ namespace Tiobon.Core.Services
#endregion
#region pageData
- if (Id != 0)
+ if (Id == 0)
+ {
+ dynamic baseData = new ExpandoObject();
+ baseData.PaperNo = null;
+ baseData.PaperName = null;
+ baseData.AnswerTime = null;
+ baseData.ScoreMethod = null;
+ baseData.TotalScore = null;
+ baseData.PassScore = null;
+ baseData.RetakeTimes = null;
+ baseData.RemarkSz = null;
+ baseData.LinkType = null;
+ baseData.CourseId = null;
+ baseData.CourseSceneId = null;
+ input.pageData.baseData = baseData;
+
+ input.pageData.examPaperSetType = "random";
+ }
+ else if (Id != 0)
{
var exampaper = await base.QueryById(Id);
@@ -332,5 +355,63 @@ namespace Tiobon.Core.Services
input.manualSetColumns = manualSetColumns;
return ServiceResult.OprateSuccess("查询成功!", input);
}
+
+ public async Task> InsertConfig(InsertGhre_ExamPaperConfigInput insert)
+ {
+ var input = new InsertExamPaperConfigInput();
+ input.tableData = Mapper.Map(insert).ToANew();
+
+ 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}'";
+ if (!string.IsNullOrWhiteSpace(insert.QuestionType))
+ sql += $" AND QuestionType='{insert.QuestionType}'";
+ if (insert.CourseId != null)
+ sql += $" AND CourseId='{insert.DifficultyLevel}'";
+ var questions = await Db.Ado.SqlQueryAsync(sql);
+
+ long parentId = SnowFlakeSingle.instance.getID();
+
+ var previews = questions.Select(x => new DefaultGhre_ExamPaperPreview()
+ {
+ Id = x.Id,
+ parentId = parentId,
+ QuestionId = x.Id,
+ }).ToList();
+ var questionIds = previews.Select(x => x.QuestionId).Distinct().ToList();
+ var questions1 = await _ghre_QuestionServices.Query(x => questionIds.Contains(x.Id));
+ var answers = await _ghre_QuestionAnswerServices.Query(x => x.QuestionId != null && questionIds.Contains(x.QuestionId.Value), "TaxisNo ASC");
+
+ previews.ForEach(x =>
+ {
+ var answers1 = answers.Where(y => y.QuestionId == x.QuestionId).ToList();
+ var detail = questions1.Select(o =>
+ new FromGhre_QuestionQuestionTypeDetail()
+ {
+ Id = o.Id,
+ difficulty = o.DifficultyLevel,
+ RemarkSz = o.QuestionAnalysis,
+ content = o.QuestionContent,
+ }).ToList();
+ detail.ForEach(y =>
+ {
+ y.answer = answers1.Where(x => x.IsCorrect == true).FirstOrDefault()?.QuestionNo;
+ y.answer1 = answers1.Where(x => x.IsCorrect == true).Select(x => x.QuestionNo).ToList();
+ y.answerList = answers.Select(x => new FromGhre_QuestionQuestionAnswerList()
+ {
+ No = x.QuestionNo,
+ label = x.AnswerContent,
+ imageUrl = x.ImageUrl,
+ imgWidthPc = x.ImageWidthPc,
+ imgWidthApp = x.ImageWidthApp,
+ }).ToList();
+ });
+
+ x.detail = detail;
+ });
+ input.previewList = previews;
+
+ return ServiceResult.OprateSuccess("查询成功!", input);
+ }
}
}
\ No newline at end of file
diff --git a/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs b/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs
index c510976f..f40c3841 100644
--- a/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs
+++ b/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs
@@ -166,7 +166,7 @@ public class Ghre_QuestionServices : BaseServices
+
+
+ 出题方式
+
+
状态
@@ -711,6 +716,211 @@
预留字段12
+
+
+ 试卷配置 (Dto.Base)
+
+
+
+
+ 试卷ID
+
+
+
+
+ 课程ID
+
+
+
+
+ 排序号
+
+
+
+
+ 难易程度
+
+
+
+
+ 题目类型
+
+
+
+
+ 题目内容ID
+
+
+
+
+ 数量
+
+
+
+
+ 分值
+
+
+
+
+ 备注
+
+
+
+
+ 默认标志
+
+
+
+
+ 预留字段1
+
+
+
+
+ 预留字段2
+
+
+
+
+ 预留字段3
+
+
+
+
+ 预留字段4
+
+
+
+
+ 预留字段5
+
+
+
+
+ 预留字段6
+
+
+
+
+ 预留字段7
+
+
+
+
+ 预留字段8
+
+
+
+
+ 预留字段9
+
+
+
+
+ 预留字段10
+
+
+
+
+ 预留字段11
+
+
+
+
+ 预留字段12
+
+
+
+
+ 试卷题目 (Dto.Base)
+
+
+
+
+ 试卷ID
+
+
+
+
+ 题目ID
+
+
+
+
+ 试卷配置ID
+
+
+
+
+ 备注
+
+
+
+
+ 默认标志
+
+
+
+
+ 预留字段1
+
+
+
+
+ 预留字段2
+
+
+
+
+ 预留字段3
+
+
+
+
+ 预留字段4
+
+
+
+
+ 预留字段5
+
+
+
+
+ 预留字段6
+
+
+
+
+ 预留字段7
+
+
+
+
+ 预留字段8
+
+
+
+
+ 预留字段9
+
+
+
+
+ 预留字段10
+
+
+
+
+ 预留字段11
+
+
+
+
+ 预留字段12
+
+
题目 (Dto.Base)
@@ -1135,6 +1345,16 @@
试卷 (Dto.EditInput)
+
+
+ 试卷配置 (Dto.EditInput)
+
+
+
+
+ 试卷题目 (Dto.EditInput)
+
+
题目 (Dto.EditInput)
@@ -1185,6 +1405,16 @@
试卷 (Dto.InsertInput)
+
+
+ 试卷配置 (Dto.InsertInput)
+
+
+
+
+ 试卷题目 (Dto.InsertInput)
+
+
题目 (Dto.InsertInput)
@@ -2009,6 +2239,11 @@
试卷风格
+
+
+ 出题方式
+
+
状态
@@ -2084,6 +2319,211 @@
预留字段12
+
+
+ 试卷配置 (Model)
+
+
+
+
+ 试卷ID
+
+
+
+
+ 课程ID
+
+
+
+
+ 排序号
+
+
+
+
+ 难易程度
+
+
+
+
+ 题目类型
+
+
+
+
+ 题目内容ID
+
+
+
+
+ 数量
+
+
+
+
+ 分值
+
+
+
+
+ 备注
+
+
+
+
+ 默认标志
+
+
+
+
+ 预留字段1
+
+
+
+
+ 预留字段2
+
+
+
+
+ 预留字段3
+
+
+
+
+ 预留字段4
+
+
+
+
+ 预留字段5
+
+
+
+
+ 预留字段6
+
+
+
+
+ 预留字段7
+
+
+
+
+ 预留字段8
+
+
+
+
+ 预留字段9
+
+
+
+
+ 预留字段10
+
+
+
+
+ 预留字段11
+
+
+
+
+ 预留字段12
+
+
+
+
+ 试卷题目 (Model)
+
+
+
+
+ 试卷ID
+
+
+
+
+ 题目ID
+
+
+
+
+ 试卷配置ID
+
+
+
+
+ 备注
+
+
+
+
+ 默认标志
+
+
+
+
+ 预留字段1
+
+
+
+
+ 预留字段2
+
+
+
+
+ 预留字段3
+
+
+
+
+ 预留字段4
+
+
+
+
+ 预留字段5
+
+
+
+
+ 预留字段6
+
+
+
+
+ 预留字段7
+
+
+
+
+ 预留字段8
+
+
+
+
+ 预留字段9
+
+
+
+
+ 预留字段10
+
+
+
+
+ 预留字段11
+
+
+
+
+ 预留字段12
+
+
题目 (Model)
@@ -3322,6 +3762,16 @@
试卷(Dto.View)
+
+
+ 试卷配置(Dto.View)
+
+
+
+
+ 试卷题目(Dto.View)
+
+
题目(Dto.View)
@@ -4480,5 +4930,20 @@
+
+
+ 试卷ID
+
+
+
+
+ 题目ID
+
+
+
+
+ 试卷配置ID
+
+
diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml
index 95ca044c..ea731fa5 100644
--- a/Tiobon.Core/Tiobon.Core.xml
+++ b/Tiobon.Core/Tiobon.Core.xml
@@ -638,11 +638,35 @@
课程场景(Controller)
+
+
+ 试卷配置(Controller)
+
+
试卷(Controller)
+
+
+ 根据Id查询数据
+
+
+
+
+
+
+ 新增配置数据
+
+
+
+
+
+
+ 试卷题目(Controller)
+
+
题目答案(Controller)