diff --git a/Tiobon.Core.Api/Controllers/Base/BaseController.cs b/Tiobon.Core.Api/Controllers/Base/BaseController.cs index 6138bf97..d9ea99b6 100644 --- a/Tiobon.Core.Api/Controllers/Base/BaseController.cs +++ b/Tiobon.Core.Api/Controllers/Base/BaseController.cs @@ -258,6 +258,8 @@ public class BaseController() { Success = false, Status = status, Message = message, Data = default, }; } + //Mapper.Map(data).ToANew() + [NonAction] public ServiceResult> SuccessPage(int page, int dataCount, int pageSize, List data, int pageCount, string message = "获取成功") { diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_QuestionController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_QuestionController.cs index 048508fc..7c6134d3 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_QuestionController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_QuestionController.cs @@ -16,6 +16,25 @@ public class Ghre_QuestionController : BaseController + /// 根据Id查询数据 + /// + /// 主键ID + /// + [HttpPost("Query/{Id}")] + public override async Task> QueryById(long Id) + { + var entity = await _service.QueryById(Id); + entity.Answers = await _ghre_QuestionAnswerServices.Query(x => x.QuestionId == Id, "TaxisNo ASC"); + if (entity is null) + return Failed("获取失败", 500); + else + return Success(entity, "获取成功"); + } + #endregion + #region 新增 /// /// 新增数据 @@ -60,7 +79,7 @@ public class Ghre_QuestionController : BaseController Put(long Id, [FromBody] EditGhre_QuestionInput editModel) { - await _ghre_QuestionAnswerServices.Delete(x=>x.QuestionId == Id); + await _ghre_QuestionAnswerServices.Delete(x => x.QuestionId == Id); var answers = editModel.Answers; if (answers.Any()) { diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml index 882a816e..ade0160c 100644 --- a/Tiobon.Core.Api/Tiobon.Core.Model.xml +++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml @@ -3297,6 +3297,11 @@ 题目(Dto.View) + + + 答案 + + 题目答案(Dto.View) diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index dd91cc29..4bbc1e99 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -525,6 +525,13 @@ 题目(Controller) + + + 根据Id查询数据 + + 主键ID + + 新增数据 diff --git a/Tiobon.Core.Model/View/Ghre/Ghre_Question.Dto.View.cs b/Tiobon.Core.Model/View/Ghre/Ghre_Question.Dto.View.cs index 2e4d609b..e8b00e1e 100644 --- a/Tiobon.Core.Model/View/Ghre/Ghre_Question.Dto.View.cs +++ b/Tiobon.Core.Model/View/Ghre/Ghre_Question.Dto.View.cs @@ -13,7 +13,7 @@ *│ 此技术信息为本公司机密信息,未经本公司书面同意禁止向第三方披露. │ *│ 作者:SimonHsiao │ *└──────────────────────────────────┘ -*/ +*/ namespace Tiobon.Core.Model.Models { @@ -23,5 +23,10 @@ namespace Tiobon.Core.Model.Models /// public class Ghre_QuestionDto : Ghre_Question { + + /// + /// 答案 + /// + public List Answers { get; set; } } }