diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_SurveyController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_SurveyController.cs index 2dd40800..e2fa288b 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_SurveyController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_SurveyController.cs @@ -56,4 +56,15 @@ public class Ghre_SurveyController : BaseController> InsertData(long id, [FromBody] InsertGhre_SurveyExtend input) => await _service.InsertData(id, input); #endregion + + #region 插入 + /// + /// 插入 + /// + /// + /// + [HttpPost("QueryData/{id}")] + public async Task> QueryData(long id) => await _service.QueryData(id); + + #endregion } \ No newline at end of file diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index ad991fe6..2209e39f 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -1254,6 +1254,13 @@ status + + + 查询菜单表单信息 + + body + + 必选修查询(Controller) @@ -1388,6 +1395,13 @@ + + + 插入 + + + + 问卷调查选项(Controller) diff --git a/Tiobon.Core.IServices/Ghre/IGhre_SurveyServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_SurveyServices.cs index 76c347d7..c2ed8818 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_SurveyServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_SurveyServices.cs @@ -13,4 +13,6 @@ public interface IGhre_SurveyServices : IBaseServices UpdateStatus(InsertGhre_SurveyInput input, string status); Task> InsertData(long id, InsertGhre_SurveyExtend insertModel); + + Task> QueryData(long id); } \ No newline at end of file diff --git a/Tiobon.Core.Model/ViewModels/Extend/InsertGhre_SurveyExtend.cs b/Tiobon.Core.Model/ViewModels/Extend/InsertGhre_SurveyExtend.cs index 1d204bfa..1fcdc956 100644 --- a/Tiobon.Core.Model/ViewModels/Extend/InsertGhre_SurveyExtend.cs +++ b/Tiobon.Core.Model/ViewModels/Extend/InsertGhre_SurveyExtend.cs @@ -45,7 +45,7 @@ public class InsertGhre_SurveyExtend /// public class InsertGhre_SurveyQuestionExtend { - + public long Id { get; set; } /// /// 题目类型 diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs index 660f9691..92d4c366 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs @@ -1420,7 +1420,7 @@ public class Ghre_ExamServices : BaseServices /// 问卷调查 (服务) @@ -42,6 +40,22 @@ public class Ghre_SurveyServices : BaseServices> QueryData(long id) + { + var entity = await base.QueryById(id); + var data = Mapper.Map(entity).ToANew(); + + var questions = await Db.Queryable().Where(x => x.SurveyId == id).ToListAsync(); + var options = await Db.Queryable().Where(x => x.SurveyId == id).ToListAsync(); + + data.Questions = Mapper.Map(questions).ToANew>(); + data.Questions.ForEach(x => + { + x.Options = Mapper.Map(options.Where(o => o.SurveyQuestionId == x.Id)).ToANew>(); + }); + return ServiceResult.OprateSuccess("成功", data); + } public async Task> InsertByStatus(InsertGhre_SurveyInput insertModel, string status) { @@ -92,7 +106,7 @@ public class Ghre_SurveyServices : BaseServices(); - + insert.Status = "Temporary"; id = await Add(insert); for (int i = 0; i < insertModel.Questions.Count; i++) @@ -118,6 +132,11 @@ public class Ghre_SurveyServices : BaseServices().Where(x => x.SurveyId == id).ExecuteCommandAsync(); await Db.Deleteable().Where(x => x.SurveyId == id).ExecuteCommandAsync(); + + var insert = Mapper.Map(insertModel).ToANew(); + + await Update(id, insert, null, ["Status"]); + for (int i = 0; i < insertModel.Questions.Count; i++) { var question = Mapper.Map(insertModel.Questions[i]).ToANew(); diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml index ad991fe6..2209e39f 100644 --- a/Tiobon.Core/Tiobon.Core.xml +++ b/Tiobon.Core/Tiobon.Core.xml @@ -1254,6 +1254,13 @@ status + + + 查询菜单表单信息 + + body + + 必选修查询(Controller) @@ -1388,6 +1395,13 @@ + + + 插入 + + + + 问卷调查选项(Controller)