From c17e1decda40238926fbafce98101c414424ed41 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Tue, 25 Mar 2025 14:39:20 +0700 Subject: [PATCH 1/2] #1274,#1277 --- src/controllers/ProfileEmployeeController.ts | 23 ++------- .../ProfileEmployeeTempController.ts | 47 +++++++++++-------- 2 files changed, 30 insertions(+), 40 deletions(-) diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 6924ff7d..2766b6a3 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -2103,29 +2103,12 @@ export class ProfileEmployeeController extends Controller { .andWhere( new Brackets((qb) => { qb.where( - requestBody.keyword != null && requestBody.keyword != "" - ? "profileEmployee.prefix LIKE :keyword" + requestBody.keyword != null && requestBody.keyword != "" + ? `CONCAT(profileEmployee.prefix, profileEmployee.firstName," ",profileEmployee.lastName) LIKE :keyword` : "1=1", { keyword: `%${requestBody.keyword}%`, - }, - ) - .orWhere( - requestBody.keyword != null && requestBody.keyword != "" - ? "profileEmployee.firstName LIKE :keyword" - : "1=1", - { - keyword: `%${requestBody.keyword}%`, - }, - ) - .orWhere( - requestBody.keyword != null && requestBody.keyword != "" - ? "profileEmployee.lastName LIKE :keyword" - : "1=1", - { - keyword: `%${requestBody.keyword}%`, - }, - ) + }) .orWhere( requestBody.keyword != null && requestBody.keyword != "" ? "profileEmployee.citizenId LIKE :keyword" diff --git a/src/controllers/ProfileEmployeeTempController.ts b/src/controllers/ProfileEmployeeTempController.ts index ff6f4a2b..264e0e1f 100644 --- a/src/controllers/ProfileEmployeeTempController.ts +++ b/src/controllers/ProfileEmployeeTempController.ts @@ -1703,28 +1703,11 @@ export class ProfileEmployeeTempController extends Controller { new Brackets((qb) => { qb.where( requestBody.keyword != null && requestBody.keyword != "" - ? "profileEmployee.prefix LIKE :keyword" + ? `CONCAT(profileEmployee.prefix, profileEmployee.firstName," ",profileEmployee.lastName) LIKE :keyword` : "1=1", { keyword: `%${requestBody.keyword}%`, - }, - ) - .orWhere( - requestBody.keyword != null && requestBody.keyword != "" - ? "profileEmployee.firstName LIKE :keyword" - : "1=1", - { - keyword: `%${requestBody.keyword}%`, - }, - ) - .orWhere( - requestBody.keyword != null && requestBody.keyword != "" - ? "profileEmployee.lastName LIKE :keyword" - : "1=1", - { - keyword: `%${requestBody.keyword}%`, - }, - ) + }) .orWhere( requestBody.keyword != null && requestBody.keyword != "" ? "profileEmployee.citizenId LIKE :keyword" @@ -1732,7 +1715,31 @@ export class ProfileEmployeeTempController extends Controller { { keyword: `%${requestBody.keyword}%`, }, - ); + ) + // .orWhere( + // requestBody.keyword != null && requestBody.keyword != "" + // ? "profileEmployee.position LIKE :keyword" + // : "1=1", + // { + // keyword: `%${requestBody.keyword}%`, + // }, + // ) + // .orWhere( + // requestBody.keyword != null && requestBody.keyword != "" + // ? "posType.posTypeName LIKE :keyword" + // : "1=1", + // { + // keyword: `%${requestBody.keyword}%`, + // }, + // ) + // .orWhere( + // requestBody.keyword != null && requestBody.keyword != "" + // ? `CONCAT(posType.posTypeShortName," ",posLevel.posLevelName) LIKE :keyword` + // : "1=1", + // { + // keyword: `%${requestBody.keyword}%`, + // }, + // ); }), ) .andWhere( From 70af866b0c66a8343e50598ada2a060cbe825de0 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Tue, 25 Mar 2025 15:12:20 +0700 Subject: [PATCH 2/2] fix --- src/controllers/ProfileSalaryTempController.ts | 1 + src/entities/PositionSalaryEditHistory.ts | 1 - src/entities/ProfileSalaryTemp.ts | 4 ++++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/controllers/ProfileSalaryTempController.ts b/src/controllers/ProfileSalaryTempController.ts index 3a2b9dca..a26f39f1 100644 --- a/src/controllers/ProfileSalaryTempController.ts +++ b/src/controllers/ProfileSalaryTempController.ts @@ -1114,6 +1114,7 @@ export class ProfileSalaryTempController extends Controller { } else if (profileEmployee) { history.profileEmployeeId = profileId; } + history.returnedDate = new Date(); history.examinerName = req.user.name; history.createdFullName = req.user.name; history.lastUpdateFullName = req.user.name; diff --git a/src/entities/PositionSalaryEditHistory.ts b/src/entities/PositionSalaryEditHistory.ts index 50003f71..75fc3df7 100644 --- a/src/entities/PositionSalaryEditHistory.ts +++ b/src/entities/PositionSalaryEditHistory.ts @@ -57,7 +57,6 @@ export class PositionSalaryEditHistory extends EntityBase { } export class CreatePositionSalaryEditHistory { - returnedDate: Date; detailForEdit: string | null; } diff --git a/src/entities/ProfileSalaryTemp.ts b/src/entities/ProfileSalaryTemp.ts index 42d13d70..556fd584 100644 --- a/src/entities/ProfileSalaryTemp.ts +++ b/src/entities/ProfileSalaryTemp.ts @@ -342,6 +342,8 @@ export class CreateProfileSalaryTemp { isGovernment?: boolean | null; positionCee?: string | null; commandName?: string | null; + posNumCodeSit?: string | null; + posNumCodeSitAbb?: string | null; } export type UpdateProfileSalaryTemp = { @@ -373,4 +375,6 @@ export type UpdateProfileSalaryTemp = { isGovernment?: boolean | null; positionCee?: string | null; commandName?: string | null; + posNumCodeSit?: string | null; + posNumCodeSitAbb?: string | null; };