From ba76e787b00b8aa8b9f986b6906b25871673a99e Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Fri, 1 Mar 2024 11:17:57 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=E0=B8=84=E0=B9=89=E0=B8=99=E0=B8=AB=E0=B8=B2=E0=B8=8A=E0=B8=B7?= =?UTF-8?q?=E0=B9=88=E0=B8=AD=E0=B8=84=E0=B8=99=E0=B8=84=E0=B8=A3=E0=B8=AD?= =?UTF-8?q?=E0=B8=87=20master/list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/PositionController.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index 614a56b1..16ca8fb4 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -1096,6 +1096,21 @@ export class PositionController extends Controller { .andWhere(revisionCondition); }), ) + .orWhere( + new Brackets((qb) => { + qb.andWhere( + body.keyword != null && body.keyword != "" + ? `CONCAT(next_holder.prefix, next_holder.firstName, next_holder.lastName) like '%${body.keyword}%'` + : "1=1", + { + keyword: `%${body.keyword}%`, + }, + ) + .andWhere(checkChildConditions) + .andWhere(typeCondition) + .andWhere(revisionCondition); + }), + ) .orderBy("posMaster.posMasterOrder", "ASC") .skip((body.page - 1) * body.pageSize) .take(body.pageSize)