题库 重写根据Id查询数据

master
xiaochanghai 1 year ago
parent 6720ac4227
commit 47cde1575b
  1. 5
      Tiobon.Core.Api/Controllers/Ghre/Ghre_QuestionController.cs
  2. 30
      Tiobon.Core.Api/Tiobon.Core.Model.xml
  3. 7
      Tiobon.Core.Api/Tiobon.Core.xml
  4. 18
      Tiobon.Core.Model/Base/Ghre/Ghre_QuestionAnswer.Dto.Base.cs
  5. 18
      Tiobon.Core.Model/Models/Ghre/Ghre_QuestionAnswer.cs
  6. 6
      Tiobon.Core.Model/ViewModels/Extend/FromGhre_QuestionInput.cs
  7. 27
      Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs
  8. 30
      Tiobon.Core/Tiobon.Core.Model.xml
  9. 7
      Tiobon.Core/Tiobon.Core.xml

@ -35,6 +35,11 @@ public class Ghre_QuestionController : BaseController<IGhre_QuestionServices, Gh
else
return Success(entity, "获取成功");
}
/// <summary>
/// 根据Id查询数据
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpPost("QueryFrom/{Id}")]
public async Task<ServiceResult<FromGhre_QuestionInput>> QueryFrom(long Id)
{

@ -826,6 +826,11 @@
题目ID
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswerBase.QuestionNo">
<summary>
题目编号
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswerBase.AnswerContent">
<summary>
答案内容
@ -841,6 +846,16 @@
图片地址
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswerBase.ImageWidthPc">
<summary>
图片宽度
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswerBase.ImageWidthApp">
<summary>
图片宽度
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswerBase.TaxisNo">
<summary>
排序号
@ -2184,6 +2199,11 @@
题目ID
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswer.QuestionNo">
<summary>
题目编号
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswer.AnswerContent">
<summary>
答案内容
@ -2199,6 +2219,16 @@
图片地址
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswer.ImageWidthPc">
<summary>
图片宽度
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswer.ImageWidthApp">
<summary>
图片宽度
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswer.TaxisNo">
<summary>
排序号

@ -553,6 +553,13 @@
<param name="Id">主键ID</param>
<returns></returns>
</member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_QuestionController.QueryFrom(System.Int64)">
<summary>
根据Id查询数据
</summary>
<param name="Id"></param>
<returns></returns>
</member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_QuestionController.Insert(Tiobon.Core.Model.Models.InsertGhre_QuestionInput)">
<summary>
新增数据

@ -6,7 +6,7 @@
*
* Ver
*
*V0.01 2024/4/28 11:02:39 SimonHsiao
*V0.01 2024/5/8 10:36:27 SimonHsiao
*
* Copyright(c) 2024 Tiobon Corporation. All Rights Reserved.
*
@ -31,6 +31,12 @@ namespace Tiobon.Core.Model.Models
/// </summary>
public long? QuestionId { get; set; }
/// <summary>
/// 题目编号
/// </summary>
[Display(Name = "QuestionNo"), Description("题目编号"), MaxLength(32, ErrorMessage = "答案内容 不能超过 32 个字符")]
public string QuestionNo { get; set; }
/// <summary>
/// 答案内容
/// </summary>
@ -48,6 +54,16 @@ namespace Tiobon.Core.Model.Models
[Display(Name = "ImageUrl"), Description("图片地址"), MaxLength(64, ErrorMessage = "图片地址 不能超过 64 个字符")]
public string ImageUrl { get; set; }
/// <summary>
/// 图片宽度
/// </summary>
public int? ImageWidthPc { get; set; }
/// <summary>
/// 图片宽度
/// </summary>
public int? ImageWidthApp { get; set; }
/// <summary>
/// 排序号
/// </summary>

@ -6,7 +6,7 @@
*
* Ver
*
*V0.01 2024/4/28 11:02:39 SimonHsiao
*V0.01 2024/5/8 10:36:27 SimonHsiao
*
* Copyright(c) 2024 Tiobon Corporation. All Rights Reserved.
*
@ -33,6 +33,12 @@ namespace Tiobon.Core.Model.Models
/// </summary>
public long? QuestionId { get; set; }
/// <summary>
/// 题目编号
/// </summary>
[Display(Name = "QuestionNo"), Description("题目编号"), MaxLength(32, ErrorMessage = "答案内容 不能超过 32 个字符")]
public string QuestionNo { get; set; }
/// <summary>
/// 答案内容
/// </summary>
@ -50,6 +56,16 @@ namespace Tiobon.Core.Model.Models
[Display(Name = "ImageUrl"), Description("图片地址"), MaxLength(64, ErrorMessage = "图片地址 不能超过 64 个字符")]
public string ImageUrl { get; set; }
/// <summary>
/// 图片宽度
/// </summary>
public int? ImageWidthPc { get; set; }
/// <summary>
/// 图片宽度
/// </summary>
public int? ImageWidthApp { get; set; }
/// <summary>
/// 排序号
/// </summary>

@ -40,6 +40,8 @@ public class FromGhre_QuestionQuestionTypeDetail
public string difficulty { get; set; }
public string content { get; set; }
public string answer { get; set; }
public List<string> answer1 { get; set; }
public string RemarkSz { get; set; }
public List<FromGhre_QuestionQuestionAnswerList> answerList { get; set; } = new List<FromGhre_QuestionQuestionAnswerList> { };
}
public class FromGhre_QuestionQuestionAnswerList
@ -47,6 +49,6 @@ public class FromGhre_QuestionQuestionAnswerList
public string No { get; set; }
public string label { get; set; }
public string imageUrl { get; set; }
public int imgWidthPc { get; set; }
public int imgWidthApp { get; set; }
public int? imgWidthPc { get; set; }
public int? imgWidthApp { get; set; }
}

@ -15,10 +15,12 @@ namespace Tiobon.Core.Services
public class Ghre_QuestionServices : BaseServices<Ghre_Question, Ghre_QuestionDto, InsertGhre_QuestionInput, EditGhre_QuestionInput>, IGhre_QuestionServices
{
private readonly IBaseRepository<Ghre_Question> _dal;
public Ghre_QuestionServices(IBaseRepository<Ghre_Question> dal)
private IGhre_QuestionAnswerServices _ghre_QuestionAnswerServices;
public Ghre_QuestionServices(IBaseRepository<Ghre_Question> dal, IGhre_QuestionAnswerServices ghre_QuestionAnswerServices)
{
this._dal = dal;
base.BaseDal = dal;
_ghre_QuestionAnswerServices = ghre_QuestionAnswerServices;
}
/// <summary>
@ -92,7 +94,28 @@ namespace Tiobon.Core.Services
if (Id != 0)
{
var question = await base.QueryById(Id);
data.PageData.questionType.ForEach(x => x.isActive = 0);
var questionType = data.PageData.questionType.Where(x => x.type == question.QuestionType).FirstOrDefault();
if (questionType != null)
{
var answers = await _ghre_QuestionAnswerServices.Query(x => x.QuestionId == Id, "TaxisNo ASC");
questionType.isActive = 1;
questionType.detail.difficulty = question.DifficultyLevel;
questionType.detail.answer = answers.Where(x => x.IsCorrect == true).FirstOrDefault()?.QuestionNo;
questionType.detail.answer1 = answers.Where(x => x.IsCorrect == true).Select(x => x.QuestionNo).ToList();
questionType.detail.answer1 = answers.Where(x => x.IsCorrect == true).Select(x => x.QuestionNo).ToList();
questionType.detail.content = question.QuestionContent;
questionType.detail.RemarkSz = question.QuestionAnalysis;
questionType.detail.answerList = answers.Select(x => new FromGhre_QuestionQuestionAnswerList()
{
No = x.QuestionNo,
label = x.AnswerContent,
imageUrl = x.ImageUrl,
imgWidthPc = x.ImageWidthPc,
imgWidthApp = x.ImageWidthApp,
}).ToList();
}
}
#endregion

@ -826,6 +826,11 @@
题目ID
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswerBase.QuestionNo">
<summary>
题目编号
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswerBase.AnswerContent">
<summary>
答案内容
@ -841,6 +846,16 @@
图片地址
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswerBase.ImageWidthPc">
<summary>
图片宽度
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswerBase.ImageWidthApp">
<summary>
图片宽度
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswerBase.TaxisNo">
<summary>
排序号
@ -2184,6 +2199,11 @@
题目ID
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswer.QuestionNo">
<summary>
题目编号
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswer.AnswerContent">
<summary>
答案内容
@ -2199,6 +2219,16 @@
图片地址
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswer.ImageWidthPc">
<summary>
图片宽度
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswer.ImageWidthApp">
<summary>
图片宽度
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_QuestionAnswer.TaxisNo">
<summary>
排序号

@ -553,6 +553,13 @@
<param name="Id">主键ID</param>
<returns></returns>
</member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_QuestionController.QueryFrom(System.Int64)">
<summary>
根据Id查询数据
</summary>
<param name="Id"></param>
<returns></returns>
</member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_QuestionController.Insert(Tiobon.Core.Model.Models.InsertGhre_QuestionInput)">
<summary>
新增数据

Loading…
Cancel
Save