Commit 9d84d3c0 authored by liudong1993's avatar liudong1993

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents 8e12519e 40299cf4
...@@ -35,5 +35,10 @@ namespace Edu.Model.Entity.Question ...@@ -35,5 +35,10 @@ namespace Edu.Model.Entity.Question
/// 删除状态 /// 删除状态
/// </summary> /// </summary>
public DateStateEnum Status { get; set; } public DateStateEnum Status { get; set; }
/// <summary>
/// JSON配置
/// </summary>
public string JsonConfig { get; set; }
} }
} }
...@@ -31,5 +31,10 @@ namespace Edu.Model.ViewModel.Question ...@@ -31,5 +31,10 @@ namespace Edu.Model.ViewModel.Question
/// 问题知识点编号【查询使用】 /// 问题知识点编号【查询使用】
/// </summary> /// </summary>
public string QPointIds { get; set; } public string QPointIds { get; set; }
/// <summary>
/// 是否选中
/// </summary>
public bool IsCheck { get; set; }
} }
} }
...@@ -47,31 +47,4 @@ namespace Edu.Model.ViewModel.Question ...@@ -47,31 +47,4 @@ namespace Edu.Model.ViewModel.Question
public bool IsAnswer { get; set; } public bool IsAnswer { get; set; }
} }
/// <summary>
/// 单选题
/// </summary>
public class singleQuestion
{
/// <summary>
/// 题目名称
/// </summary>
public string Title { get; set; }
/// <summary>
/// 答案解析
/// </summary>
public string AnswerAnalysis { get; set; }
/// <summary>
/// 选项列表
/// </summary>
public List<optionItem> AnswerOptionList { get; set; }
/// <summary>
/// 难易程度
/// </summary>
public DifficultyTypeEnum EasyType { get; set; }
}
} }
\ No newline at end of file
...@@ -53,5 +53,10 @@ namespace Edu.Model.ViewModel.Question ...@@ -53,5 +53,10 @@ namespace Edu.Model.ViewModel.Question
/// </summary> /// </summary>
public string QDifficultyType { get; set; } public string QDifficultyType { get; set; }
/// <summary>
/// 选项
/// </summary>
public object AnswerObj { get; set; }
} }
} }
\ No newline at end of file
using Edu.Model.ViewModel.Question;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Module.Question
{
/// <summary>
/// 解析问题
/// </summary>
public class AnalysisQuestionTypeModule
{
/// <summary>
/// 问题解析
/// </summary>
/// <param name="key"></param>
/// <param name="data"></param>
/// <returns></returns>
public object ParsingQuestion(string key, string data)
{
var obj = new object();
switch (key)
{
//单选题
case "single":
obj = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(data);
break;
//多选题
case "multiple":
obj = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(data);
break;
}
return obj;
}
}
}
...@@ -29,6 +29,11 @@ namespace Edu.Module.Question ...@@ -29,6 +29,11 @@ namespace Edu.Module.Question
/// </summary> /// </summary>
private readonly RB_Question_PointRepository question_PointRepository = new RB_Question_PointRepository(); private readonly RB_Question_PointRepository question_PointRepository = new RB_Question_PointRepository();
/// <summary>
/// 问题解析处理类
/// </summary>
private readonly AnalysisQuestionTypeModule analysisQuestion = new AnalysisQuestionTypeModule();
/// <summary> /// <summary>
/// 获取题目类型列表 /// 获取题目类型列表
/// </summary> /// </summary>
...@@ -143,8 +148,19 @@ namespace Edu.Module.Question ...@@ -143,8 +148,19 @@ namespace Edu.Module.Question
/// <returns></returns> /// <returns></returns>
public RB_Question_ViewModel GetQuestionModule(object QuestionId) public RB_Question_ViewModel GetQuestionModule(object QuestionId)
{ {
return questionRepository.GetEntity<RB_Question_ViewModel>(QuestionId); var extModel = questionRepository.GetEntity<RB_Question_ViewModel>(QuestionId);
if (extModel != null)
{
extModel.AnswerObj = analysisQuestion.ParsingQuestion(extModel.QuestionTypeKey, extModel.Answer);
if (!string.IsNullOrEmpty(extModel.Knowledge))
{
extModel.QuestionPointList = GetPointListModule(new RB_Question_Point_ViewModel() { QPointIds = extModel.Knowledge });
} }
}
return extModel;
}
/// <summary> /// <summary>
/// 获取问题知识点列表 /// 获取问题知识点列表
......
...@@ -3,6 +3,7 @@ using Edu.Model.ViewModel.Question; ...@@ -3,6 +3,7 @@ using Edu.Model.ViewModel.Question;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Question namespace Edu.Repository.Question
{ {
...@@ -33,7 +34,7 @@ WHERE 1=1 ...@@ -33,7 +34,7 @@ WHERE 1=1
} }
if (!string.IsNullOrEmpty(query.QPointIds)) if (!string.IsNullOrEmpty(query.QPointIds))
{ {
builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Question_Point_ViewModel.CourseId), query.QPointIds); builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Question_Point_ViewModel.PointId), query.QPointIds);
} }
} }
return Get<RB_Question_Point_ViewModel>(builder.ToString()).ToList(); return Get<RB_Question_Point_ViewModel>(builder.ToString()).ToList();
...@@ -49,6 +50,7 @@ WHERE 1=1 ...@@ -49,6 +50,7 @@ WHERE 1=1
/// <returns></returns> /// <returns></returns>
public List<RB_Question_Point_ViewModel> GetPointPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Question_Point_ViewModel query) public List<RB_Question_Point_ViewModel> GetPointPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Question_Point_ViewModel query)
{ {
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@"
SELECT * SELECT *
...@@ -64,10 +66,15 @@ WHERE 1=1 ...@@ -64,10 +66,15 @@ WHERE 1=1
} }
if (!string.IsNullOrEmpty(query.QPointIds)) if (!string.IsNullOrEmpty(query.QPointIds))
{ {
builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Question_Point_ViewModel.CourseId), query.QPointIds); builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Question_Point_ViewModel.PointId), query.QPointIds);
}
if (!string.IsNullOrEmpty(query.PointName))
{
builder.AppendFormat(" AND {0} LIKE @PointName ", nameof(RB_Question_Point_ViewModel.PointName));
parameters.Add("PointName", "%" + query.PointName.Trim() + "%");
} }
} }
return GetPage<RB_Question_Point_ViewModel>(pageIndex,pageSize,out rowsCount,builder.ToString()).ToList(); return GetPage<RB_Question_Point_ViewModel>(pageIndex,pageSize,out rowsCount,builder.ToString(), parameters).ToList();
} }
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment