From b4cbec0541f9c14322cb41678ccde6084b9019e9 Mon Sep 17 00:00:00 2001 From: moss <> Date: Wed, 30 Apr 2025 13:35:39 +0700 Subject: [PATCH] search profile salary --- src/controllers/SalaryPeriodController.ts | 2 +- .../SalaryPeriodEmployeeController.ts | 22 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/controllers/SalaryPeriodController.ts b/src/controllers/SalaryPeriodController.ts index 794ccea..6a2d047 100644 --- a/src/controllers/SalaryPeriodController.ts +++ b/src/controllers/SalaryPeriodController.ts @@ -1584,7 +1584,7 @@ export class SalaryPeriodController extends Controller { // : `profile.isRetired = false` // : "1=1", body.isRetire == null - ? `profile.isRetired = false` + ? "1=1" : body.isRetire == "1" ? `profile.isRetired = true` : body.isRetire == "0" diff --git a/src/controllers/SalaryPeriodEmployeeController.ts b/src/controllers/SalaryPeriodEmployeeController.ts index 472f153..6e442bf 100644 --- a/src/controllers/SalaryPeriodEmployeeController.ts +++ b/src/controllers/SalaryPeriodEmployeeController.ts @@ -1099,11 +1099,18 @@ export class SalaryPeriodEmployeeController extends Controller { type: body.type == null ? "" : `${body.type.toUpperCase()}`, }) .andWhere( - body.isRetire != null - ? body.isRetire == "1" + // body.isRetire != null + // ? body.isRetire == "1" + // ? `profile.isRetired = true` + // : `profile.isRetired = false` + // : "1=1", + body.isRetire == null + ? "1=1" + : body.isRetire == "1" ? `profile.isRetired = true` - : `profile.isRetired = false` - : "1=1", + : body.isRetire == "0" + ? `profile.isRetired = false` + : "1=1", ) .andWhere({ salaryOrgId: salaryOrg.id, @@ -1121,10 +1128,9 @@ export class SalaryPeriodEmployeeController extends Controller { .orWhere("profile.prefix LIKE :keyword", { keyword: `%${body.keyword}%` }) .orWhere("profile.firstName LIKE :keyword", { keyword: `%${body.keyword}%` }) .orWhere("profile.lastName LIKE :keyword", { keyword: `%${body.keyword}%` }) - .orWhere( - "CONCAT(profile.posTypeShort,' ',profile.posLevel) LIKE :keyword", - { keyword: `%${body.keyword}%` }, - ) + .orWhere("CONCAT(profile.posTypeShort,' ',profile.posLevel) LIKE :keyword", { + keyword: `%${body.keyword}%`, + }) .orWhere( "CONCAT(profile.prefix,profile.firstName,' ',profile.lastName) LIKE :keyword", { keyword: `%${body.keyword}%` },