|
|
|
@ -1,10 +1,8 @@ |
|
|
|
|
|
|
|
|
|
using System.Data; |
|
|
|
|
using System.Dynamic; |
|
|
|
|
using AgileObjects.AgileMapper; |
|
|
|
|
using MongoDB.Driver.Linq; |
|
|
|
|
using SqlSugar; |
|
|
|
|
using Tiobon.Core.Common; |
|
|
|
|
using Tiobon.Core.Common.DB.Dapper.Extensions; |
|
|
|
|
using Tiobon.Core.IRepository.Base; |
|
|
|
|
using Tiobon.Core.IServices; |
|
|
|
|
using Tiobon.Core.Model; |
|
|
|
@ -21,6 +19,7 @@ namespace Tiobon.Core.Services |
|
|
|
|
private IGhre_ExamPaperConfigServices _ghre_ExamPaperConfigServices; |
|
|
|
|
private IGhre_ExamPaperQuestionServices _ghre_ExamPaperQuestionServices; |
|
|
|
|
private IGhre_QuestionServices _ghre_QuestionServices; |
|
|
|
|
readonly IGhrs_UserServices _ghrs_UserServices; |
|
|
|
|
private IGhre_QuestionAnswerServices _ghre_QuestionAnswerServices; |
|
|
|
|
private readonly IBaseRepository<Ghre_ExamPaper> _dal; |
|
|
|
|
|
|
|
|
@ -28,7 +27,8 @@ namespace Tiobon.Core.Services |
|
|
|
|
IGhre_ExamPaperConfigServices ghre_ExamPaperConfigServices, |
|
|
|
|
IGhre_QuestionServices ghre_QuestionServices, |
|
|
|
|
IGhre_QuestionAnswerServices ghre_QuestionAnswerServices, |
|
|
|
|
IGhre_ExamPaperQuestionServices ghre_ExamPaperQuestionServices) |
|
|
|
|
IGhre_ExamPaperQuestionServices ghre_ExamPaperQuestionServices, |
|
|
|
|
IGhrs_UserServices ghrs_UserServices) |
|
|
|
|
{ |
|
|
|
|
this._dal = dal; |
|
|
|
|
base.BaseDal = dal; |
|
|
|
@ -36,6 +36,8 @@ namespace Tiobon.Core.Services |
|
|
|
|
_ghre_ExamPaperQuestionServices = ghre_ExamPaperQuestionServices; |
|
|
|
|
_ghre_QuestionServices = ghre_QuestionServices; |
|
|
|
|
_ghre_QuestionAnswerServices = ghre_QuestionAnswerServices; |
|
|
|
|
_ghrs_UserServices = ghrs_UserServices; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public async Task<ServiceResult<DefaultGhre_ExamPaperInput>> QueryDefault(long Id) |
|
|
|
@ -302,6 +304,19 @@ namespace Tiobon.Core.Services |
|
|
|
|
baseData.CourseSceneId = exampaper.LinkId; |
|
|
|
|
input.pageData.baseData = baseData; |
|
|
|
|
|
|
|
|
|
#region 系统信息 |
|
|
|
|
var userIds = new List<int?>(); |
|
|
|
|
if (exampaper.CreateBy != null) |
|
|
|
|
userIds.Add(Convert.ToInt32(exampaper.CreateBy.Value)); |
|
|
|
|
if (exampaper.UpdateBy != null) |
|
|
|
|
userIds.Add(Convert.ToInt32(exampaper.UpdateBy.Value)); |
|
|
|
|
var users = await _ghrs_UserServices.Query(x => userIds.Contains(x.UserId)); |
|
|
|
|
if (exampaper.CreateBy != null) |
|
|
|
|
input.CreateDataInfo = $"创建信息 {users.FirstOrDefault(x => x.UserId == exampaper.CreateBy)?.UserName} 于 {(exampaper.CreateTime != null ? exampaper.CreateTime.Value.ToString(@"yyyy\/MM\/dd HH:mm") : null)} 创建"; |
|
|
|
|
if (exampaper.UpdateBy != null) |
|
|
|
|
input.CreateDataInfo = $"修改信息 {users.FirstOrDefault(x => x.UserId == exampaper.UpdateBy)?.UserName} 于 {(exampaper.UpdateTime != null ? exampaper.UpdateTime.Value.ToString(@"yyyy\/MM\/dd HH:mm") : null)} 最后修改"; |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
input.pageData.styleInfo.coverImage = exampaper.CoverUrl; |
|
|
|
|
input.pageData.styleInfo.paperStyle = exampaper.Style; |
|
|
|
@ -392,7 +407,7 @@ namespace Tiobon.Core.Services |
|
|
|
|
sql += $" AND QuestionType='{insert.QuestionType}'"; |
|
|
|
|
if (insert.CourseId != null) |
|
|
|
|
sql += $" AND CourseId='{insert.CourseId}'"; |
|
|
|
|
if (insert.CourseId != null) |
|
|
|
|
if (insert.QuestionId != null) |
|
|
|
|
sql += $" AND Id='{insert.QuestionId}'"; |
|
|
|
|
sql += $" ORDER BY GuidValue ASC"; |
|
|
|
|
var questions = await Db.Ado.SqlQueryAsync<Ghre_Question>(sql); |
|
|
|
|