From 6791dde26ff0de70fb51906ad34632a6a060b416 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Thu, 29 Feb 2024 13:40:49 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B8=84=E0=B8=B4?= =?UTF-8?q?=E0=B8=A7=E0=B8=A3=E0=B8=B5=E0=B9=88=E0=B8=84=E0=B9=89=E0=B8=99?= =?UTF-8?q?=E0=B8=AB=E0=B8=B2=E0=B8=84=E0=B8=99=E0=B9=83=E0=B8=99=E0=B8=A3?= =?UTF-8?q?=E0=B8=B0=E0=B8=9A=E0=B8=9A=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99?= =?UTF-8?q?=E0=B9=80=E0=B8=94=E0=B8=B7=E0=B8=AD=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/SalaryPeriodController.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/controllers/SalaryPeriodController.ts b/src/controllers/SalaryPeriodController.ts index 06dbc9e..3e7861e 100644 --- a/src/controllers/SalaryPeriodController.ts +++ b/src/controllers/SalaryPeriodController.ts @@ -441,7 +441,13 @@ export class SalaryPeriodController extends Controller { async GetListsSalaryProfile( @Path() id: string, @Body() - body: { page: number; pageSize: number; keyword?: string; type?: any; isRetire?: boolean }, + body: { + page: number; + pageSize: number; + keyword?: string; + type?: any; + isRetire?: boolean | null; + }, ) { const salaryOrg = await this.salaryOrgRepository.findOne({ where: { @@ -455,12 +461,10 @@ export class SalaryPeriodController extends Controller { .createQueryBuilder("profile") .andWhere( new Brackets((qb) => { - qb.andWhere(body.type != null && body.type != "" ? "profile.type LIKE :type" : "1=1", { - type: `%${body.type.toUpperCase()}%`, + qb.andWhere(body.type != null && body.type != "" ? `profile.type LIKE :type` : "1=1", { + type: body.type == null ? "" : `%${body.type.toUpperCase()}%`, }) - .andWhere(body.isRetire != null ? "profile.isRetire = :isRetire" : "1=1", { - isRetire: `${body.isRetire}`, - }) + .andWhere(body.isRetire != null ? `profile.isRetired = ${body.isRetire}` : "1=1") .andWhere({ salaryOrgId: salaryOrg.id, })