Migrate เพิ่มฟิลด์สถานะคัดกรองคุณสมบัติ

This commit is contained in:
harid 2026-03-10 13:44:50 +07:00
parent 46481ef1ec
commit 2deb2927a6
5 changed files with 1671 additions and 10 deletions

View file

@ -1418,7 +1418,7 @@ namespace BMA.EHR.Recruit.Service.Controllers
// ใช้ dictionary lookup แทน query DB ทีละรอบ
if (!string.IsNullOrEmpty(r.ExamId) && recruitsDict.TryGetValue(r.ExamId, out var recruit))
{
r.CitizenId = workSheet?.Cells[row, 3]?.GetValue<string>();
r.CitizenId = workSheet?.Cells[row, 3]?.GetValue<string>()?.Trim();
// ภาคความรู้ความสามารถที่ใช้เฉพาะตำแหน่ง
r.FullA = 200;
@ -1457,6 +1457,9 @@ namespace BMA.EHR.Recruit.Service.Controllers
}
r.RemarkScore = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 15]?.GetValue<string>()) ? string.Empty : workSheet?.Cells[row, 15]?.GetValue<string>();
r.ExamAttribute = (workSheet?.Cells[row, 16]?.GetValue<string>()?.Trim() == "ผ่าน") ? "มีคุณสมบัติ" : "ไม่มีคุณสมบัติ";
r.Major = workSheet.Name;
r.CreatedAt = DateTime.Now;
@ -2036,10 +2039,15 @@ namespace BMA.EHR.Recruit.Service.Controllers
: "",
examScore = x.score == null ? 0.0 : x.score.TotalScore,
examResult = x.score == null ? "" : x.score.ExamStatus,
examAttribute = x.recruit.Certificates.Any() && x.recruit.Certificates.First().IssueDate != null
? _recruitService.CheckValidCertificate(x.recruit.Certificates.First().IssueDate, 5)
? "มีคุณสมบัติ" : "ไม่มีคุณสมบัติ"
: "ไม่มีคุณสมบัติ",
// examAttribute = x.recruit.Certificates.Any() && x.recruit.Certificates.First().IssueDate != null
// ? _recruitService.CheckValidCertificate(x.recruit.Certificates.First().IssueDate, 5)
// ? "มีคุณสมบัติ" : "ไม่มีคุณสมบัติ"
// : "ไม่มีคุณสมบัติ",
examAttribute = x.score == null
? "ไม่มีคุณสมบัติ"
: string.IsNullOrEmpty(x.score.ExamAttribute)
? "ไม่มีคุณสมบัติ"
: x.score.ExamAttribute,
remark = x.recruit.Remark,
isSpecial = x.recruit.Isspecial == "Y" ? x.recruit.Isspecial : "",
applyDate = x.recruit.ApplyDate.HasValue && x.recruit.ApplyDate.Value != DateTime.MinValue
@ -2170,11 +2178,16 @@ namespace BMA.EHR.Recruit.Service.Controllers
: ""
: "",
ExamResult = sr == null ? "" : sr.ExamStatus,
ExamAttribute = p.Certificates.Count > 0 ?
_recruitService.CheckValidCertificate(p.Certificates.First().IssueDate, 5)
? "มีคุณสมบัติ"
: "ไม่มีคุณสมบัติ"
: "ไม่มีคุณสมบัติ",
// ExamAttribute = p.Certificates.Count > 0 ?
// _recruitService.CheckValidCertificate(p.Certificates.First().IssueDate, 5)
// ? "มีคุณสมบัติ"
// : "ไม่มีคุณสมบัติ"
// : "ไม่มีคุณสมบัติ",
ExamAttribute = sr == null
? "ไม่มีคุณสมบัติ"
: string.IsNullOrEmpty(sr.ExamAttribute)
? "ไม่มีคุณสมบัติ"
: sr.ExamAttribute,
IsSpecial = p.Isspecial,
Remark = p.Remark,
University = p.Educations.First().University,

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,32 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recruit.Service.Migrations
{
/// <inheritdoc />
public partial class update_table_RecruitScore_add_field_ExamAttribute : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ExamAttribute",
table: "RecruitScores",
type: "varchar(50)",
maxLength: 50,
nullable: false,
defaultValue: "",
comment: "สถานะคัดกรองคุณสมบัติ")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ExamAttribute",
table: "RecruitScores");
}
}
}

View file

@ -1200,6 +1200,12 @@ namespace BMA.EHR.Recruit.Service.Migrations
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("ExamAttribute")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("สถานะคัดกรองคุณสมบัติ");
b.Property<string>("ExamId")
.IsRequired()
.HasMaxLength(50)

View file

@ -80,6 +80,9 @@ namespace BMA.EHR.Recruit.Service.Models.Recruits
[Comment("หมายเหตุจากลำดับที่สอบได้")]
public string RemarkExamOrder { get; set; } = string.Empty;
[MaxLength(50), Comment("สถานะคัดกรองคุณสมบัติ")]
public string ExamAttribute { get; set; } = string.Empty;
public ScoreImport ScoreImport { get; set; }
}
}