Commit ebe850a1 authored by 黄奎's avatar 黄奎

新增实体类

parent b776b5e2
......@@ -122,5 +122,10 @@ namespace Edu.Model.Entity.Exam
/// 考级程度
/// </summary>
public LevelTypeEnum? LevelType { get; set; }
/// <summary>
/// 题目分数
/// </summary>
public decimal Score { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.Exam
{
/// <summary>
/// 试卷题目分组实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Examination_Group
{
/// <summary>
/// 试卷分组编号
/// </summary>
public int GId { get; set; }
/// <summary>
/// 试卷编号
/// </summary>
public int PaperId { get; set; }
/// <summary>
/// 分组名称
/// </summary>
public string GroupName { get; set; }
/// <summary>
/// 问题类型编号
/// </summary>
public int QuestionTypeId { get; set; }
/// <summary>
/// 问题类型Key
/// </summary>
public string QuestionTypeKey { get; set; }
/// <summary>
/// 排序
/// </summary>
public int GSortNum { get; set; }
}
}
using System;
using Edu.Common.Enum.Question;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
......@@ -27,6 +28,11 @@ namespace Edu.Model.Entity.Exam
/// </summary>
public string QuestionBandIds { get; set; }
/// <summary>
/// 难易程度(1-易,2-中,3-难)
/// </summary>
public DifficultyTypeEnum DifficultyType { get; set; }
/// <summary>
/// 创建时间
/// </summary>
......
using Edu.Model.Entity.Exam;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Exam
{
/// <summary>
/// 试卷题目分组视图实体类
/// </summary>
public class RB_Examination_Group_ViewModel: RB_Examination_Group
{
/// <summary>
/// 试卷分组题目列表
/// </summary>
public List<RB_Examination_Details_ViewModel> DetailsList { get; set; }
/// <summary>
/// 试卷编号【查询使用】
/// </summary>
public string QPaperIds { get; set; }
}
}
......@@ -21,8 +21,8 @@ namespace Edu.Model.ViewModel.Exam
public string CreateTimeStr { get { return Common.ConvertHelper.FormatDate(this.CreateTime); } }
/// <summary>
/// 试卷问题列表
/// 试卷题目分组列表
/// </summary>
public List<RB_Examination_Details_ViewModel> DetailsList { get; set; }
public List<RB_Examination_Group_ViewModel> GroupList { get; set; }
}
}
This diff is collapsed.
......@@ -40,5 +40,6 @@ WHERE 1=1
}
return Get<RB_Examination_Details_ViewModel>(builder.ToString()).ToList();
}
}
}
using Edu.Model.Entity.Exam;
using Edu.Model.ViewModel.Exam;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
namespace Edu.Repository.Exam
{
/// <summary>
/// 试卷题目分组仓储层
/// </summary>
public class RB_Examination_GroupRepository : BaseRepository<RB_Examination_Group>
{
/// <summary>
/// 获取试卷题目列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Examination_Group_ViewModel> GetExaminationGroupListRepository(RB_Examination_Group_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Examination_Group AS A
WHERE 1=1
");
if (query != null)
{
if (query.PaperId > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Examination_Group_ViewModel.PaperId), query.PaperId);
}
if (!string.IsNullOrEmpty(query.QPaperIds))
{
builder.AppendFormat(@" AND A.{0} IN({1}) ", nameof(RB_Examination_Group_ViewModel.PaperId), query.QPaperIds);
}
}
return Get<RB_Examination_Group_ViewModel>(builder.ToString()).ToList();
}
}
}
......@@ -27,7 +27,7 @@ namespace Edu.Repository.Exam
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Examination_Paper
FROM RB_Examination_Paper AS A
WHERE 1=1
");
if (query != null)
......
......@@ -76,45 +76,72 @@ namespace Edu.WebApi.Controllers.Exam
PaperId = base.ParmJObj.GetInt("PaperId"),
PaperName = base.ParmJObj.GetStringValue("PaperName"),
QuestionBandIds = base.ParmJObj.GetStringValue("QuestionBandIds"),
DifficultyType=(DifficultyTypeEnum)base.ParmJObj.GetInt("DifficultyType"),
CreateBy = UserInfo.Id,
CreateTime = DateTime.Now,
Group_Id = base.UserInfo.Group_Id,
};
extModel.DetailsList = new List<RB_Examination_Details_ViewModel>();
string details = base.ParmJObj.GetStringValue("DetailsList");
if (!string.IsNullOrEmpty(details))
extModel.GroupList = new List<RB_Examination_Group_ViewModel>();
string groups = base.ParmJObj.GetStringValue("GroupList");
if (!string.IsNullOrEmpty(groups))
{
JArray jarray = JArray.Parse(details);
JArray jarray = JArray.Parse(groups);
if (jarray != null && jarray.Count > 0)
{
int gSortNum = 0;
foreach (var jItem in jarray)
{
JObject jobj = JObject.Parse(jItem.ToString());
extModel.DetailsList.Add(new RB_Examination_Details_ViewModel()
RB_Examination_Group_ViewModel gModel = new RB_Examination_Group_ViewModel()
{
Id = jobj.GetInt("Id"),
GId = jobj.GetInt("GId"),
PaperId = jobj.GetInt("PaperId"),
BankId = jobj.GetInt("BankId"),
QuestionId = jobj.GetInt("QuestionId"),
Title = jobj.GetStringValue("Title"),
QuestionContent = jobj.GetStringValue("QuestionContent"),
DifficultyType = (DifficultyTypeEnum)jobj.GetInt("DifficultyType"),
AnswerParse = jobj.GetStringValue("AnswerParse"),
GroupName = jobj.GetStringValue("GroupName"),
QuestionTypeId = jobj.GetInt("QuestionTypeId"),
QuestionTypeKey = jobj.GetStringValue("QuestionTypeKey"),
Knowledge = jobj.GetStringValue("Knowledge"),
CreateBy = base.UserInfo.Id,
CreateTime = DateTime.Now,
UpdateBy = base.UserInfo.Id,
UpdateTime = DateTime.Now,
IsUpdateJobExam = base.ParmJObj.GetInt("IsUpdateJobExam"),
Status = Common.Enum.DateStateEnum.Normal,
SortNum = base.ParmJObj.GetInt("SortNum"),
Answer = base.ParmJObj.GetStringValue("Answer"),
IsMutex = base.ParmJObj.GetInt("IsMutex"),
Category = (QuestionCategoryEnum)base.ParmJObj.GetInt("Category"),
LevelType = (LevelTypeEnum)base.ParmJObj.GetInt("LevelType"),
});
GSortNum= gSortNum,
DetailsList = new List<RB_Examination_Details_ViewModel>(),
};
gSortNum++;
string details = jobj.GetStringValue("DetailsList");
if (!string.IsNullOrEmpty(details))
{
JArray subArray = JArray.Parse(details);
int dSortNum = 0;
foreach (var sItem in subArray)
{
JObject sObj = JObject.Parse(sItem.ToString());
var detailModel = new RB_Examination_Details_ViewModel()
{
Id = sObj.GetInt("Id"),
PaperId = sObj.GetInt("PaperId"),
BankId = sObj.GetInt("BankId"),
QuestionId = sObj.GetInt("QuestionId"),
Title = sObj.GetStringValue("Title"),
QuestionContent = sObj.GetStringValue("QuestionContent"),
DifficultyType = (DifficultyTypeEnum)sObj.GetInt("DifficultyType"),
AnswerParse = sObj.GetStringValue("AnswerParse"),
QuestionTypeId = sObj.GetInt("QuestionTypeId"),
QuestionTypeKey = sObj.GetStringValue("QuestionTypeKey"),
Knowledge = sObj.GetStringValue("Knowledge"),
CreateBy = base.UserInfo.Id,
CreateTime = DateTime.Now,
UpdateBy = base.UserInfo.Id,
UpdateTime = DateTime.Now,
IsUpdateJobExam = sObj.GetInt("IsUpdateJobExam"),
Status = Common.Enum.DateStateEnum.Normal,
SortNum = dSortNum,
Answer = sObj.GetStringValue("Answer"),
IsMutex = sObj.GetInt("IsMutex"),
Category = (QuestionCategoryEnum)sObj.GetInt("Category"),
LevelType = (LevelTypeEnum)sObj.GetInt("LevelType"),
Score = sObj.GetDecimal("Score"),
};
dSortNum++;
gModel.DetailsList.Add(detailModel);
}
}
extModel.GroupList.Add(gModel);
}
}
}
......@@ -133,5 +160,18 @@ namespace Edu.WebApi.Controllers.Exam
var model = paperModule.GetExaminationPaperModule(PaperId);
return ApiResult.Success(data: model);
}
/// <summary>
/// 根据编号删除试卷题目
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult DeletePaperQuestion()
{
var PaperId = base.ParmJObj.GetInt("PaperId");
var model = paperModule.RemoveExaminationDetailsModule(PaperId);
return ApiResult.Success(data: model);
}
}
}
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