From 9c7072c128000cc7f7bd5c27b1f38b8dfb0a79f2 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Tue, 19 Mar 2024 12:24:29 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B8=84=E0=B9=89?= =?UTF-8?q?=E0=B8=99=E0=B8=AB=E0=B8=B2=E0=B8=84=E0=B8=99=E0=B8=84=E0=B8=A3?= =?UTF-8?q?=E0=B8=AD=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/EmployeePositionController.ts | 1 + src/controllers/ProfileController.ts | 6 ++++-- src/controllers/ProfileEmployeeController.ts | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/controllers/EmployeePositionController.ts b/src/controllers/EmployeePositionController.ts index 547ec5ae..1d02bfaf 100644 --- a/src/controllers/EmployeePositionController.ts +++ b/src/controllers/EmployeePositionController.ts @@ -1996,6 +1996,7 @@ export class EmployeePositionController extends Controller { dataMaster.isSit = requestBody.isSit; dataMaster.current_holderId = requestBody.profileId; + dataMaster.next_holderId = requestBody.profileId; await this.employeePosMasterRepository.save(dataMaster); return new HttpSuccess(); diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 93525bc9..6a54d831 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -384,8 +384,10 @@ export class ProfileController extends Controller { ) .andWhere( new Brackets((qb) => { - qb.where("next_holders.id IS NULL").orWhere("next_holders.id NOT IN (:...ids)", { - ids: orgRevision.posMasters.map((x) => x.next_holderId), + qb.where("profile.id NOT IN (:...ids)", { + ids: orgRevision.posMasters + .filter((x) => x.next_holderId != null) + .map((x) => x.next_holderId), }); }), ) diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 7c420ad9..6b7e2bbb 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -379,8 +379,10 @@ export class ProfileEmployeeController extends Controller { ) .andWhere( new Brackets((qb) => { - qb.where("next_holders.id IS NULL").orWhere("next_holders.id NOT IN (:...ids)", { - ids: orgRevision.posMasters.map((x) => x.next_holderId), + qb.where("profile.id NOT IN (:...ids)", { + ids: orgRevision.posMasters + .filter((x) => x.next_holderId != null) + .map((x) => x.next_holderId), }); }), )