小程序接口调优
This commit is contained in:
@@ -37,6 +37,8 @@ namespace BLL
|
||||
TrainTypeName = db.Base_TrainType.FirstOrDefault(b => b.TrainTypeId == y.TrainTypeId).TrainTypeName,
|
||||
TrainLevelName = db.Base_TrainLevel.FirstOrDefault(b => b.TrainLevelId == y.TrainLevelId).TrainLevelName,
|
||||
PlanStatesName = y.States == "3" ? "已完成" : "培训中",
|
||||
TaskStatesName = x.States == "2" ? "已完成" : "培训中",
|
||||
TrainingItemCode = getTrainingItemCode(y.PlanId),
|
||||
IsRetakeCourse = y.IsRetakeCourse == 1 ? 1 : 0,
|
||||
}).ToList();
|
||||
if (!string.IsNullOrWhiteSpace(isRetakeCourse))
|
||||
@@ -46,6 +48,18 @@ namespace BLL
|
||||
return getDataLists;
|
||||
}
|
||||
}
|
||||
|
||||
public static string getTrainingItemCode(string PlanId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var ids = db.Training_PlanItem.Where(xx => xx.PlanId == PlanId).Select(x => x.CompanyTrainingItemId).ToList();
|
||||
var codes = db.Training_CompanyTrainingItem.Where(x => ids.Contains(x.CompanyTrainingItemId)).Select(x => x.CompanyTrainingItemCode);
|
||||
string res = string.Join(",", codes);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 根据TaskId获取培训任务教材列表
|
||||
@@ -62,6 +76,8 @@ namespace BLL
|
||||
GetDataService.CreateTrainingTaskItemByTaskId(taskId);
|
||||
|
||||
var getDataLists = (from x in db.Training_TaskItem
|
||||
join y in db.Training_CompanyTrainingItem on x.TrainingItemCode equals y.CompanyTrainingItemCode into temp
|
||||
from y in temp.DefaultIfEmpty()
|
||||
where x.TaskId == taskId
|
||||
orderby x.TrainingItemCode
|
||||
select new Model.TrainingTaskItemItem
|
||||
@@ -69,11 +85,12 @@ namespace BLL
|
||||
TaskItemId = x.TaskItemId,
|
||||
TaskId = x.TaskId,
|
||||
PlanId = x.PlanId,
|
||||
PersonId = x.PersonId,
|
||||
StartTime = x.StartTime,
|
||||
EndTime = x.EndTime,
|
||||
LearnTime = x.LearnTime,
|
||||
LearningTime = x.LearnTime,
|
||||
AttachTime = y.LearningTime,
|
||||
VideoProgress = x.VideoProgress,
|
||||
PersonId = x.PersonId,
|
||||
TrainingItemCode = x.TrainingItemCode,
|
||||
TrainingItemName = x.TrainingItemName,
|
||||
AttachUrl = x.AttachUrl.Replace('\\', '/'),
|
||||
|
||||
Reference in New Issue
Block a user