Browse Source

问卷题目加适用性别

master
wxd 3 months ago
parent
commit
3ee3366bb4
  1. 9
      src/Shentun.WebPeis.Application.Contracts/Questions/CreateQuestionDto.cs
  2. 5
      src/Shentun.WebPeis.Application.Contracts/Questions/QuestionTreeListDto.cs
  3. 7
      src/Shentun.WebPeis.Application.Contracts/Questions/UpdateQuestionDto.cs
  4. 8
      src/Shentun.WebPeis.Application/Questions/QuestionAppService.cs
  5. 4
      src/Shentun.WebPeis.Domain/Questions/QuestionManager.cs
  6. 8428
      src/Shentun.WebPeis.EntityFrameworkCore/Migrations/20260121100831_update_question_add_for_sex_id.Designer.cs
  7. 31
      src/Shentun.WebPeis.EntityFrameworkCore/Migrations/20260121100831_update_question_add_for_sex_id.cs
  8. 8
      src/Shentun.WebPeis.EntityFrameworkCore/Migrations/WebPeisDbContextModelSnapshot.cs

9
src/Shentun.WebPeis.Application.Contracts/Questions/CreateQuestionDto.cs

@ -44,7 +44,12 @@ namespace Shentun.WebPeis.Questions
/// </summary>
public char IsShow { get; set; }
/// <summary>
/// 适用性别
/// </summary>
public char ForSexId { get; set; } = 'A';
}
}

5
src/Shentun.WebPeis.Application.Contracts/Questions/QuestionTreeListDto.cs

@ -58,6 +58,11 @@ namespace Shentun.WebPeis.Questions
public int DisplayOrder { get; set; }
/// <summary>
/// 适用性别
/// </summary>
public char ForSexId { get; set; }
public List<QuestionTreeListDto> TreeChildren { get; set; }
}

7
src/Shentun.WebPeis.Application.Contracts/Questions/UpdateQuestionDto.cs

@ -43,6 +43,11 @@ namespace Shentun.WebPeis.Questions
public char IsShow { get; set; }
/// <summary>
/// 适用性别
/// </summary>
public char ForSexId { get; set; } = 'A';
}
}

8
src/Shentun.WebPeis.Application/Questions/QuestionAppService.cs

@ -96,12 +96,13 @@ namespace Shentun.WebPeis.Questions
QuestionSubjectTypeId = p.QuestionSubjectTypeId,
QuestionTypeId = p.QuestionTypeId,
SimpleCode = p.SimpleCode,
DisplayOrder = p.DisplayOrder
DisplayOrder = p.DisplayOrder,
ForSexId = p.ForSexId
};
return GetTree(items.ToList(), 0, "");
}
/// <summary>
/// 创建
@ -111,7 +112,7 @@ namespace Shentun.WebPeis.Questions
public async Task<QuestionDto> CreateAsync(CreateQuestionDto input)
{
var createEntity = ObjectMapper.Map<CreateQuestionDto, Question>(input);
createEntity.QuestionId= GuidGenerator.Create();
createEntity.QuestionId = GuidGenerator.Create();
var entity = await _questionManager.CreateAsync(createEntity);
entity = await _questionRepository.InsertAsync(entity);
var dto = ObjectMapper.Map<Question, QuestionDto>(entity);
@ -203,6 +204,7 @@ namespace Shentun.WebPeis.Questions
QuestionTypeId = p.QuestionTypeId,
SimpleCode = p.SimpleCode,
DisplayOrder = p.DisplayOrder,
ForSexId = p.ForSexId,
TreeChildren = subs.ToList()
}
).ToList();

4
src/Shentun.WebPeis.Domain/Questions/QuestionManager.cs

@ -47,7 +47,8 @@ namespace Shentun.WebPeis.Questions
QuestionSubjectTypeId = entity.QuestionSubjectTypeId,
SimpleCode = LanguageConverter.GetPYSimpleCode(entity.QuestionName),
DisplayOrder = await EntityHelper.CreateMaxDisplayOrder<Question>(_questionRepository),
QuestionTypeId = entity.QuestionTypeId
QuestionTypeId = entity.QuestionTypeId,
ForSexId = entity.ForSexId
};
}
@ -75,6 +76,7 @@ namespace Shentun.WebPeis.Questions
targetEntity.QuestionSubjectTypeId = sourceEntity.QuestionSubjectTypeId;
targetEntity.SimpleCode = LanguageConverter.GetPYSimpleCode(sourceEntity.QuestionName);
targetEntity.QuestionTypeId = sourceEntity.QuestionTypeId;
targetEntity.ForSexId = sourceEntity.ForSexId;
}

8428
src/Shentun.WebPeis.EntityFrameworkCore/Migrations/20260121100831_update_question_add_for_sex_id.Designer.cs
File diff suppressed because it is too large
View File

31
src/Shentun.WebPeis.EntityFrameworkCore/Migrations/20260121100831_update_question_add_for_sex_id.cs

@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Shentun.WebPeis.Migrations
{
/// <inheritdoc />
public partial class update_question_add_for_sex_id : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<char>(
name: "for_sex_id",
table: "question",
type: "character(1)",
maxLength: 1,
nullable: false,
defaultValueSql: "'A'::bpchar",
comment: "适用性别,M-男,F-女,A-全部");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "for_sex_id",
table: "question");
}
}
}

8
src/Shentun.WebPeis.EntityFrameworkCore/Migrations/WebPeisDbContextModelSnapshot.cs

@ -3524,6 +3524,14 @@ namespace Shentun.WebPeis.Migrations
.HasDefaultValue(999999)
.HasColumnName("display_order");
b.Property<char>("ForSexId")
.ValueGeneratedOnAdd()
.HasMaxLength(1)
.HasColumnType("character(1)")
.HasColumnName("for_sex_id")
.HasDefaultValueSql("'A'::bpchar")
.HasComment("适用性别,M-男,F-女,A-全部");
b.Property<char?>("IsActive")
.HasMaxLength(1)
.HasColumnType("character(1)")

Loading…
Cancel
Save