From 5f97ab1ac79263e380180ad7f4e82b437e490edb Mon Sep 17 00:00:00 2001 From: Kittapath Date: Mon, 4 Mar 2024 09:43:02 +0700 Subject: [PATCH] no message --- src/controllers/PositionController.ts | 3 ++- src/controllers/ProfileController.ts | 2 +- src/entities/PosDict.ts | 14 +++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index cb561752..aec5ea78 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -1066,6 +1066,7 @@ export class PositionController extends Controller { .leftJoinAndSelect("posMaster.orgChild4", "orgChild4") .leftJoinAndSelect("posMaster.current_holder", "current_holder") .leftJoinAndSelect("posMaster.next_holder", "next_holder") + .leftJoinAndSelect("posMaster.orgRevision", "orgRevision") .where(conditions) .orWhere( new Brackets((qb) => { @@ -1085,7 +1086,7 @@ export class PositionController extends Controller { new Brackets((qb) => { qb.andWhere( body.keyword != null && body.keyword != "" - ? `CONCAT(current_holder.prefix, current_holder.firstName, current_holder.lastName) like '%${body.keyword}%'` + ? `CASE WHEN orgRevision.orgRevisionIsDraft = true THEN CONCAT(next_holder.prefix, next_holder.firstName,' ', next_holder.lastName) ELSE CONCAT(current_holder.prefix, current_holder.firstName,' ' , current_holder.lastName) END LIKE '%${body.keyword}%'` : "1=1", { keyword: `%${body.keyword}%`, diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 3da9ec80..3e44e046 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -384,7 +384,7 @@ 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.id), + ids: orgRevision.posMasters.map((x) => x.next_holderId), }); }), ) diff --git a/src/entities/PosDict.ts b/src/entities/PosDict.ts index 51bb8199..544d860a 100644 --- a/src/entities/PosDict.ts +++ b/src/entities/PosDict.ts @@ -79,25 +79,25 @@ export class PosDict extends EntityBase { export class CreatePosDict { @Column() - posDictName: string; + posDictName: string | null; @Column() - posDictField: string; + posDictField: string | null; @Column("uuid") - posTypeId: string; + posTypeId: string | null; @Column("uuid") - posLevelId: string; + posLevelId: string | null; @Column() - posExecutiveId?: string; + posExecutiveId?: string | null; @Column() - posDictExecutiveField: string; + posDictExecutiveField: string | null; @Column() - posDictArea: string; + posDictArea: string | null; @Column() isSpecial: boolean;