特种设备修改,车辆管理人员管理合并,考试接口创建试卷和答题使用redis
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using EmitMapper;
|
||||
using EmitMapper.MappingConfiguration;
|
||||
using Model;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
@@ -253,7 +254,9 @@ namespace BLL
|
||||
};
|
||||
|
||||
db.Training_TestRecordItem.InsertAllOnSubmit(getItems);
|
||||
db.SubmitChanges();
|
||||
db.SubmitChanges();
|
||||
BLL.RedisHelper redis = new BLL.RedisHelper();
|
||||
redis.SetObjString(testRecordId, getItems);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -615,33 +618,40 @@ namespace BLL
|
||||
/// <returns>考试人员</returns>
|
||||
public static List<Model.TestRecordItemItem> geTestRecordItemListByTestRecordId(string testRecordId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
BLL.RedisHelper redis = new BLL.RedisHelper();
|
||||
var getDataLists= redis.GetObjString<List<TestRecordItemItem>>(testRecordId); //先从redis取数据,不存在再从数据库取
|
||||
if (getDataLists.Count==0)
|
||||
{
|
||||
var getDataLists = (from x in db.Training_TestRecordItem
|
||||
where x.TestRecordId == testRecordId
|
||||
orderby x.TestType, x.TrainingItemCode
|
||||
select new Model.TestRecordItemItem
|
||||
{
|
||||
TestRecordItemId = x.TestRecordItemId,
|
||||
TestRecordId = x.TestRecordId,
|
||||
TrainingItemCode = x.TrainingItemCode,
|
||||
TrainingItemName = x.TrainingItemName,
|
||||
Abstracts = x.Abstracts,
|
||||
AttachUrl = x.AttachUrl.Replace("\\", "/") ?? "",
|
||||
TestType = x.TestType,
|
||||
TestTypeName = x.TestType == "1" ? "单选题" : (x.TestType == "2" ? "多选题" : "判断题"),
|
||||
AItem = x.AItem ?? "",
|
||||
BItem = x.BItem ?? "",
|
||||
CItem = x.CItem ?? "",
|
||||
DItem = x.DItem ?? "",
|
||||
EItem = x.EItem ?? "",
|
||||
AnswerItems = x.AnswerItems ?? "",
|
||||
Score = x.Score ?? 0,
|
||||
SubjectScore = x.SubjectScore ?? 0,
|
||||
SelectedItem = x.SelectedItem ?? "",
|
||||
}).ToList();
|
||||
return getDataLists;
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
getDataLists = (from x in db.Training_TestRecordItem
|
||||
where x.TestRecordId == testRecordId
|
||||
orderby x.TestType, x.TrainingItemCode
|
||||
select new Model.TestRecordItemItem
|
||||
{
|
||||
TestRecordItemId = x.TestRecordItemId,
|
||||
TestRecordId = x.TestRecordId,
|
||||
TrainingItemCode = x.TrainingItemCode,
|
||||
TrainingItemName = x.TrainingItemName,
|
||||
Abstracts = x.Abstracts,
|
||||
AttachUrl = x.AttachUrl.Replace("\\", "/") ?? "",
|
||||
TestType = x.TestType,
|
||||
TestTypeName = x.TestType == "1" ? "单选题" : (x.TestType == "2" ? "多选题" : "判断题"),
|
||||
AItem = x.AItem ?? "",
|
||||
BItem = x.BItem ?? "",
|
||||
CItem = x.CItem ?? "",
|
||||
DItem = x.DItem ?? "",
|
||||
EItem = x.EItem ?? "",
|
||||
AnswerItems = x.AnswerItems ?? "",
|
||||
Score = x.Score ?? 0,
|
||||
SubjectScore = x.SubjectScore ?? 0,
|
||||
SelectedItem = x.SelectedItem ?? "",
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return getDataLists;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user