From a8b77ec2fb57ea7b2ca256e4874cdfa548186649 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Thu, 29 Feb 2024 12:08:11 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=84=E0=B9=89=E0=B8=99=E0=B8=AB=E0=B8=B2?= =?UTF-8?q?=E0=B8=84=E0=B8=99=E0=B9=80=E0=B8=81=E0=B8=A9=E0=B8=B5=E0=B8=A2?= =?UTF-8?q?=E0=B8=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/SalaryPeriodController.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/controllers/SalaryPeriodController.ts b/src/controllers/SalaryPeriodController.ts index 537e8cd..06dbc9e 100644 --- a/src/controllers/SalaryPeriodController.ts +++ b/src/controllers/SalaryPeriodController.ts @@ -440,7 +440,8 @@ export class SalaryPeriodController extends Controller { @Put("org/{id}") async GetListsSalaryProfile( @Path() id: string, - @Body() body: { page: number; pageSize: number; keyword?: string; type: string }, + @Body() + body: { page: number; pageSize: number; keyword?: string; type?: any; isRetire?: boolean }, ) { const salaryOrg = await this.salaryOrgRepository.findOne({ where: { @@ -452,11 +453,14 @@ export class SalaryPeriodController extends Controller { } const [salaryProfile, total] = await AppDataSource.getRepository(SalaryProfile) .createQueryBuilder("profile") - .orWhere( + .andWhere( new Brackets((qb) => { qb.andWhere(body.type != null && body.type != "" ? "profile.type LIKE :type" : "1=1", { type: `%${body.type.toUpperCase()}%`, }) + .andWhere(body.isRetire != null ? "profile.isRetire = :isRetire" : "1=1", { + isRetire: `${body.isRetire}`, + }) .andWhere({ salaryOrgId: salaryOrg.id, })