keyword
This commit is contained in:
parent
c8cc885546
commit
bf49a8cf74
1 changed files with 28 additions and 12 deletions
|
|
@ -1984,17 +1984,33 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
cmd.Parameters.Clear();
|
||||
cmd.Parameters.Add(p_Id);
|
||||
|
||||
// เพิ่ม dynamic filter
|
||||
if (!string.IsNullOrWhiteSpace(req.ExamAttribute))
|
||||
{
|
||||
sb.Append(" AND examAttribute = @a ");
|
||||
cmd.Parameters.Add(new MySqlParameter("@a", req.ExamAttribute));
|
||||
}
|
||||
//// เพิ่ม dynamic filter
|
||||
//if (!string.IsNullOrWhiteSpace(req.ExamAttribute))
|
||||
//{
|
||||
// sb.Append(" AND examAttribute = @a ");
|
||||
// cmd.Parameters.Add(new MySqlParameter("@a", req.ExamAttribute));
|
||||
//}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(req.ExamResult))
|
||||
//if (!string.IsNullOrWhiteSpace(req.ExamResult))
|
||||
//{
|
||||
// sb.Append(" AND result = @r ");
|
||||
// cmd.Parameters.Add(new MySqlParameter("@r", req.ExamResult));
|
||||
//}
|
||||
|
||||
var keywordParam = req.keyword?.Trim(); // Keyword จาก FE
|
||||
if (!string.IsNullOrWhiteSpace(keywordParam))
|
||||
{
|
||||
sb.Append(" AND result = @r ");
|
||||
cmd.Parameters.Add(new MySqlParameter("@r", req.ExamResult));
|
||||
sb.Append(@"
|
||||
AND (
|
||||
examID LIKE @kw
|
||||
OR profileID LIKE @kw
|
||||
OR prefix LIKE @kw
|
||||
OR fullName LIKE @kw
|
||||
OR hddPosition LIKE @kw
|
||||
OR position_name LIKE @kw
|
||||
)
|
||||
");
|
||||
cmd.Parameters.Add(new MySqlParameter("@kw", $"%{keywordParam}%"));
|
||||
}
|
||||
|
||||
// Paging และ sorting
|
||||
|
|
@ -2051,9 +2067,9 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
// 3️. ดึงสรุปคะแนน
|
||||
// ---------------------------
|
||||
dynamic header = null;
|
||||
int _count = await _context.Recruits.Where(x => x.RecruitImport.Id == id).CountAsync();
|
||||
if (data.Count > 0)
|
||||
{
|
||||
int _count = await _context.Recruits.Where(x => x.Id == id).CountAsync();
|
||||
header = await _context.RecruitScores
|
||||
.Include(x => x.ScoreImport)
|
||||
.Where(x => x.ScoreImport.RecruitImportId == id)
|
||||
|
|
@ -2072,7 +2088,7 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
.FirstOrDefaultAsync()
|
||||
?? new // ใช้ null-coalescing กันกรณีไม่มีข้อมูล (แทน else เดิม)
|
||||
{
|
||||
count = 0,
|
||||
count = _count,
|
||||
pass = 0,
|
||||
notpass = 0,
|
||||
missed_exam = 0,
|
||||
|
|
@ -2083,7 +2099,7 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
{
|
||||
header = new
|
||||
{
|
||||
count = 0,
|
||||
count = _count,
|
||||
pass = 0,
|
||||
notpass = 0,
|
||||
missed_exam = 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue