From 6d36c9b05fa02918a93007ee9229691017e73516 Mon Sep 17 00:00:00 2001 From: kittapath Date: Thu, 29 Aug 2024 17:57:34 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=20=E0=B8=84?= =?UTF-8?q?=E0=B9=89=E0=B8=99=E0=B8=AB=E0=B8=B2=20=E0=B8=97=E0=B8=B0?= =?UTF-8?q?=E0=B9=80=E0=B8=9A=E0=B8=B5=E0=B8=A2=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/OrganizationController.ts | 24 ++++++++-------- src/controllers/ProfileController.ts | 30 +++++++++++++------- src/controllers/ProfileEmployeeController.ts | 20 ++++++------- 3 files changed, 42 insertions(+), 32 deletions(-) diff --git a/src/controllers/OrganizationController.ts b/src/controllers/OrganizationController.ts index b2fe7381..453016ea 100644 --- a/src/controllers/OrganizationController.ts +++ b/src/controllers/OrganizationController.ts @@ -3893,9 +3893,9 @@ export class OrganizationController extends Controller { .where("orgChild1.orgRootId IN (:...ids)", { ids: orgRootIds }) .andWhere( _data.child1 != undefined && _data.child1 != null - ? _data.child1[0] != null - ? `orgChild1.id IN (:...node)` - : `orgChild1.id is null` + ? _data.child1[0] != null + ? `orgChild1.id IN (:...node)` + : `orgChild1.id is null` : "1=1", { node: _data.child1, @@ -3927,9 +3927,9 @@ export class OrganizationController extends Controller { .where("orgChild2.orgChild1Id IN (:...ids)", { ids: orgChild1Ids }) .andWhere( _data.child2 != undefined && _data.child2 != null - ? _data.child2[0] != null - ? `orgChild2.id IN (:...node)` - : `orgChild2.id is null` + ? _data.child2[0] != null + ? `orgChild2.id IN (:...node)` + : `orgChild2.id is null` : "1=1", { node: _data.child2, @@ -3962,9 +3962,9 @@ export class OrganizationController extends Controller { .where("orgChild3.orgChild2Id IN (:...ids)", { ids: orgChild2Ids }) .andWhere( _data.child3 != undefined && _data.child3 != null - ? _data.child3[0] != null - ? `orgChild3.id IN (:...node)` - : `orgChild3.id is null` + ? _data.child3[0] != null + ? `orgChild3.id IN (:...node)` + : `orgChild3.id is null` : "1=1", { node: _data.child3, @@ -3997,9 +3997,9 @@ export class OrganizationController extends Controller { .where("orgChild4.orgChild3Id IN (:...ids)", { ids: orgChild3Ids }) .andWhere( _data.child4 != undefined && _data.child4 != null - ? _data.child4[0] != null - ? `orgChild4.id IN (:...node)` - : `orgChild4.id is null` + ? _data.child4[0] != null + ? `orgChild4.id IN (:...node)` + : `orgChild4.id is null` : "1=1", { node: _data.child4, diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 31d1c3be..4d6a97dd 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -2637,42 +2637,52 @@ export class ProfileController extends Controller { .leftJoinAndSelect("current_holders.orgChild4", "orgChild4") .andWhere( _data.root != undefined && _data.root != null - ? (_data.root[0] !=null ? `current_holders.orgRootId = :root` : `current_holders.orgRootId is null`) + ? _data.root[0] != null + ? `current_holders.orgRootId IN (:...root)` + : `current_holders.orgRootId is null` : "1=1", { - root: _data.root[0], + root: _data.root, }, ) .andWhere( _data.child1 != undefined && _data.child1 != null - ? (_data.child1[0] !=null ? `current_holders.orgChild1Id = :child1` : `current_holders.orgChild1Id is null`) + ? _data.child1[0] != null + ? `current_holders.orgChild1Id IN (:...child1)` + : `current_holders.orgChild1Id is null` : "1=1", { - child1: _data.child1[0], + child1: _data.child1, }, ) .andWhere( _data.child2 != undefined && _data.child2 != null - ? (_data.child2[0] !=null ? `current_holders.orgChild2Id = :child2` : `current_holders.orgChild2Id is null`) + ? _data.child2[0] != null + ? `current_holders.orgChild2Id IN (:...child2)` + : `current_holders.orgChild2Id is null` : "1=1", { - child2: _data.child2[0], + child2: _data.child2, }, ) .andWhere( _data.child3 != undefined && _data.child3 != null - ? (_data.child3[0] !=null ? `current_holders.orgChild3Id = :child3` : `current_holders.orgChild3Id is null`) + ? _data.child3[0] != null + ? `current_holders.orgChild3Id IN (:...child3)` + : `current_holders.orgChild3Id is null` : "1=1", { - child3: _data.child3[0], + child3: _data.child3, }, ) .andWhere( _data.child4 != undefined && _data.child4 != null - ? (_data.child4[0] !=null ? `current_holders.orgChild4Id = :child4` : `current_holders.orgChild4Id is null`) + ? _data.child4[0] != null + ? `current_holders.orgChild4Id IN (:...child4)` + : `current_holders.orgChild4Id is null` : "1=1", { - child4: _data.child4[0], + child4: _data.child4, }, ) .andWhere( diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index ea176399..2c40bc14 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -1134,51 +1134,51 @@ export class ProfileEmployeeController extends Controller { .andWhere( _data.root != undefined && _data.root != null ? _data.root[0] != null - ? `current_holders.orgRootId = :root` + ? `current_holders.orgRootId IN (:...root)` : `current_holders.orgRootId is null` : "1=1", { - root: _data.root[0], + root: _data.root, }, ) .andWhere( _data.child1 != undefined && _data.child1 != null ? _data.child1[0] != null - ? `current_holders.orgChild1Id = :child1` + ? `current_holders.orgChild1Id IN (:...child1)` : `current_holders.orgChild1Id is null` : "1=1", { - child1: _data.child1[0], + child1: _data.child1, }, ) .andWhere( _data.child2 != undefined && _data.child2 != null ? _data.child2[0] != null - ? `current_holders.orgChild2Id = :child2` + ? `current_holders.orgChild2Id IN (:...child2)` : `current_holders.orgChild2Id is null` : "1=1", { - child2: _data.child2[0], + child2: _data.child2, }, ) .andWhere( _data.child3 != undefined && _data.child3 != null ? _data.child3[0] != null - ? `current_holders.orgChild3Id = :child3` + ? `current_holders.orgChild3Id IN (:...child3)` : `current_holders.orgChild3Id is null` : "1=1", { - child3: _data.child3[0], + child3: _data.child3, }, ) .andWhere( _data.child4 != undefined && _data.child4 != null ? _data.child4[0] != null - ? `current_holders.orgChild4Id = :child4` + ? `current_holders.orgChild4Id IN (:...child4)` : `current_holders.orgChild4Id is null` : "1=1", { - child4: _data.child4[0], + child4: _data.child4, }, ) .andWhere(