问卷题库查询接口新增选项返回

master
xiaochanghai 1 month ago
parent 9d1c279b4b
commit 2f8996cbe8
  1. 5
      Tiobon.Core.Model/View/Ghre/Ghre_SurveyQuestionPool.Dto.View.cs
  2. 20
      Tiobon.Core.Services/Ghre/Ghre_SurveyQuestionPoolServices.cs

@ -15,6 +15,8 @@
*
*/
using Tiobon.Core.Model.ViewModels.Extend;
namespace Tiobon.Core.Model.Models;
/// <summary>
@ -34,4 +36,7 @@ public class Ghre_SurveyQuestionPoolDto : Ghre_SurveyQuestionPool
public string BuiltInLabel { get; set; }
public List<InsertGhre_SurveyOptionExtend> Options { get; set; } = new List<InsertGhre_SurveyOptionExtend>();
}

@ -1,6 +1,4 @@
using Mysqlx.Crud;
using System.Net;
using Tiobon.Core.IServices;
using Org.BouncyCastle.Crypto;
namespace Tiobon.Core.Services;
@ -26,6 +24,10 @@ public class Ghre_SurveyQuestionPoolServices : BaseServices<Ghre_SurveyQuestionP
var result = await base.QueryFilterPage(filter, condition, IsEnable);
var ids = result.result.DT_TableDataT1.Select(x => x.Id).ToList();
var answers = await _ghre_SurveyQuestionPoolOptionServicesServices.Query(x => x.SurveyQuestionPoolId != null && ids.Contains(x.SurveyQuestionPoolId.Value), "TaxisNo ASC");
//data.ForEach(async x =>
//{
// x.DifficultyLevelLabel = await GetParaLabel("DifficultyLevel", x.DifficultyLevel);
@ -45,6 +47,18 @@ public class Ghre_SurveyQuestionPoolServices : BaseServices<Ghre_SurveyQuestionP
{
x.BuiltInLabel = x.BuiltIn == 1 ? "是" : "否";
x.QuestionType = await GetParaLabel("SurveyQuestionType", x.QuestionType);
x.Options = answers.Where(o => o.SurveyQuestionPoolId == x.Id)
.Select(x => new InsertGhre_SurveyOptionExtend()
{
OptionNo = x.OptionNo,
OptionContent = x.OptionContent,
IsOther = x.IsOther,
ImageUrl = x.ImageUrl,
ImageWidthPc = x.ImageWidthPc,
ImageWidthApp = x.ImageWidthApp,
Score = x.Score,
}).ToList();
});

Loading…
Cancel
Save