|
|
|
@ -936,4 +936,46 @@ delete from Ghre_ExamPaperQuestion WHERE ExamPaperId='{id}';"); |
|
|
|
|
return new ServiceResult<CommonSelect>() { Success = true, Message = "查询成功", Data = result, }; |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region 复制 |
|
|
|
|
|
|
|
|
|
public async Task<ServiceResult> Copy(long id) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
var entity = await base.QueryById(id); |
|
|
|
|
entity.PaperName = entity.PaperName + "_复制"; |
|
|
|
|
entity.PaperNo = await GenerateContinuousSequence("Ghre_ExamPaper", "PaperNo", "P"); |
|
|
|
|
|
|
|
|
|
entity.Status = "Draft"; |
|
|
|
|
var id1 = await base.Add(Mapper.Map(entity).ToANew<InsertGhre_ExamPaperInput>()); |
|
|
|
|
|
|
|
|
|
var configs = await _ghre_ExamPaperConfigServices.Query(x => x.ExamPaperId == id); |
|
|
|
|
var questions = await _ghre_ExamPaperQuestionServices.Query(x => x.ExamPaperId == id); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < configs.Count; i++) |
|
|
|
|
{ |
|
|
|
|
var config = configs[i]; |
|
|
|
|
config.ExamPaperId = id1; |
|
|
|
|
|
|
|
|
|
var configId = await _ghre_ExamPaperConfigServices.Add(Mapper.Map(config).ToANew<InsertGhre_ExamPaperConfigInput>()); |
|
|
|
|
|
|
|
|
|
var questions1 = Mapper.Map(questions.Where(x => x.ConfigId == config.Id)).ToANew<List<InsertGhre_ExamPaperQuestionInput>>(); |
|
|
|
|
questions1.ForEach(x => |
|
|
|
|
{ |
|
|
|
|
x.ConfigId = configId; |
|
|
|
|
x.ExamPaperId = id1; |
|
|
|
|
}); |
|
|
|
|
await _ghre_ExamPaperQuestionServices.Add(questions1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//var result = await BaseDal.Update(entities); |
|
|
|
|
//if (status == "Released") |
|
|
|
|
// return ServiceResult.OprateSuccess("发布成功!"); |
|
|
|
|
//else if (status == "Draft") |
|
|
|
|
// return ServiceResult.OprateSuccess(" 已启用成功,请进入草稿箱查看!"); |
|
|
|
|
//else |
|
|
|
|
// return ServiceResult.OprateSuccess("停用成功!"); |
|
|
|
|
return ServiceResult.OprateSuccess("复制成功!"); |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
} |