From c42a4c3a12b606aa7ccb4879a8d8403e094d1fab Mon Sep 17 00:00:00 2001 From: harid Date: Thu, 19 Feb 2026 15:16:30 +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=AA=E0=B8=B4=E0=B8=97=E0=B8=98=E0=B8=B4=E0=B9=8C=20PARENT?= =?UTF-8?q?=20=E0=B9=83=E0=B8=AB=E0=B9=89=E0=B9=80=E0=B8=AB=E0=B9=87?= =?UTF-8?q?=E0=B8=99=E0=B8=82=E0=B9=89=E0=B8=AD=E0=B8=A1=E0=B8=B9=E0=B8=A5?= =?UTF-8?q?=E0=B8=97=E0=B8=B1=E0=B9=89=E0=B8=87=E0=B8=AB=E0=B8=A1=E0=B8=94?= =?UTF-8?q?=E0=B8=97=E0=B8=B8=E0=B8=81=E0=B8=AB=E0=B8=99=E0=B9=88=E0=B8=A7?= =?UTF-8?q?=E0=B8=A2=E0=B8=87=E0=B8=B2=E0=B8=99=20#54?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../KpiUserDevelopmentController.ts | 3 +- .../KpiUserEvaluationController.ts | 128 +++++++++--------- src/interfaces/permission.ts | 6 +- 3 files changed, 72 insertions(+), 65 deletions(-) diff --git a/src/controllers/KpiUserDevelopmentController.ts b/src/controllers/KpiUserDevelopmentController.ts index fea06cb..f2029d4 100644 --- a/src/controllers/KpiUserDevelopmentController.ts +++ b/src/controllers/KpiUserDevelopmentController.ts @@ -393,7 +393,8 @@ export class KpiUserDevelopmentController extends Controller { _data.child1 != undefined && _data.child1 != null ? _data.child1[0] != null ? `kpiUserEvaluation.child1DnaId IN (:...child1)` - : `kpiUserEvaluation.child1DnaId is ${_data.privilege == "PARENT" ? "not null" : "null"}` + // : `kpiUserEvaluation.child1DnaId is ${_data.privilege == "PARENT" ? "not null" : "null"}` + : `kpiUserEvaluation.child1DnaId is null` : "1=1", { child1: _data.child1, diff --git a/src/controllers/KpiUserEvaluationController.ts b/src/controllers/KpiUserEvaluationController.ts index 02b95fe..00645b6 100644 --- a/src/controllers/KpiUserEvaluationController.ts +++ b/src/controllers/KpiUserEvaluationController.ts @@ -261,7 +261,7 @@ export class KpiUserEvaluationController extends Controller { let conditions: string[] = []; let params: any = {}; - if (_data.privilege === "CHILD" || _data.privilege === "PARENT" || _data.privilege === "BROTHER") { + if (_data.privilege === "CHILD" || /*_data.privilege === "PARENT" ||*/ _data.privilege === "BROTHER") { if (_data.privilege === "CHILD") { if (level === 0 && orgDna.rootDnaId) { @@ -295,7 +295,8 @@ export class KpiUserEvaluationController extends Controller { params, }; } - } else if (_data.privilege === "BROTHER") { + } + else if (_data.privilege === "BROTHER") { const parentLevel = level !== null ? level - 1 : null; if (parentLevel != null && parentLevel === 0 && orgDna.rootDnaId) { conditions.push("kpiUserEvaluation.orgDnaId = :root"); @@ -323,36 +324,37 @@ export class KpiUserEvaluationController extends Controller { params, }; } - } else if (_data.privilege === "PARENT") { - if (level === 0) { - if (orgDna.rootDnaId) { - conditions.push("kpiUserEvaluation.orgDnaId = :root"); - params.root = orgDna.rootDnaId; - } - } else if (level === 1) { - if (orgDna.rootDnaId) { - conditions.push("kpiUserEvaluation.orgDnaId = :root AND kpiUserEvaluation.child1DnaId IS NOT NULL"); - params.root = orgDna.rootDnaId; - } - } else if (level === 2) { - conditions.push("kpiUserEvaluation.child1DnaId = :child1 AND kpiUserEvaluation.child2DnaId IS NOT NULL"); - params.child1 = orgDna.child1DnaId; - } else if (level === 3) { - conditions.push("kpiUserEvaluation.child2DnaId = :child2 AND kpiUserEvaluation.child3DnaId IS NOT NULL"); - params.child2 = orgDna.child2DnaId; - } else if (level === 4) { - conditions.push("kpiUserEvaluation.child3DnaId = :child3 AND kpiUserEvaluation.child4DnaId IS NOT NULL"); - params.child3 = orgDna.child3DnaId; - } + } + // else if (_data.privilege === "PARENT") { + // if (level === 0) { + // if (orgDna.rootDnaId) { + // conditions.push("kpiUserEvaluation.orgDnaId = :root"); + // params.root = orgDna.rootDnaId; + // } + // } else if (level === 1) { + // if (orgDna.rootDnaId) { + // conditions.push("kpiUserEvaluation.orgDnaId = :root AND kpiUserEvaluation.child1DnaId IS NOT NULL"); + // params.root = orgDna.rootDnaId; + // } + // } else if (level === 2) { + // conditions.push("kpiUserEvaluation.child1DnaId = :child1 AND kpiUserEvaluation.child2DnaId IS NOT NULL"); + // params.child1 = orgDna.child1DnaId; + // } else if (level === 3) { + // conditions.push("kpiUserEvaluation.child2DnaId = :child2 AND kpiUserEvaluation.child3DnaId IS NOT NULL"); + // params.child2 = orgDna.child2DnaId; + // } else if (level === 4) { + // conditions.push("kpiUserEvaluation.child3DnaId = :child3 AND kpiUserEvaluation.child4DnaId IS NOT NULL"); + // params.child3 = orgDna.child3DnaId; + // } - if (conditions.length > 0) { - typeCondition = { - query: conditions.join(" AND "), - params, - }; - } - } - } else if (_data.privilege === "OWNER" || _data.privilege === "ROOT") { + // if (conditions.length > 0) { + // typeCondition = { + // query: conditions.join(" AND "), + // params, + // }; + // } + // } + } else if (_data.privilege === "OWNER" || _data.privilege === "ROOT" || _data.privilege === "PARENT") { if (orgDna.rootDnaId) { conditions.push("kpiUserEvaluation.orgDnaId = :root"); params.root = orgDna.rootDnaId; @@ -600,7 +602,7 @@ export class KpiUserEvaluationController extends Controller { let conditions: string[] = []; let params: any = {}; - if (_data.privilege === "CHILD" || _data.privilege === "PARENT" || _data.privilege === "BROTHER") { + if (_data.privilege === "CHILD" || /*_data.privilege === "PARENT" ||*/ _data.privilege === "BROTHER") { if (_data.privilege === "CHILD") { if (level === 0 && orgDna.rootDnaId) { @@ -634,7 +636,8 @@ export class KpiUserEvaluationController extends Controller { params, }; } - } else if (_data.privilege === "BROTHER") { + } + else if (_data.privilege === "BROTHER") { const parentLevel = level !== null ? level - 1 : null; if (parentLevel != null && parentLevel === 0 && orgDna.rootDnaId) { conditions.push("kpiUserEvaluation.orgDnaId = :root"); @@ -662,36 +665,37 @@ export class KpiUserEvaluationController extends Controller { params, }; } - } else if (_data.privilege === "PARENT") { - if (level === 0) { - if (orgDna.rootDnaId) { - conditions.push("kpiUserEvaluation.orgDnaId = :root"); - params.root = orgDna.rootDnaId; - } - } else if (level === 1) { - if (orgDna.rootDnaId) { - conditions.push("kpiUserEvaluation.orgDnaId = :root AND kpiUserEvaluation.child1DnaId IS NOT NULL"); - params.root = orgDna.rootDnaId; - } - } else if (level === 2) { - conditions.push("kpiUserEvaluation.child1DnaId = :child1 AND kpiUserEvaluation.child2DnaId IS NOT NULL"); - params.child1 = orgDna.child1DnaId; - } else if (level === 3) { - conditions.push("kpiUserEvaluation.child2DnaId = :child2 AND kpiUserEvaluation.child3DnaId IS NOT NULL"); - params.child2 = orgDna.child2DnaId; - } else if (level === 4) { - conditions.push("kpiUserEvaluation.child3DnaId = :child3 AND kpiUserEvaluation.child4DnaId IS NOT NULL"); - params.child3 = orgDna.child3DnaId; - } + } + // else if (_data.privilege === "PARENT") { + // if (level === 0) { + // if (orgDna.rootDnaId) { + // conditions.push("kpiUserEvaluation.orgDnaId = :root"); + // params.root = orgDna.rootDnaId; + // } + // } else if (level === 1) { + // if (orgDna.rootDnaId) { + // conditions.push("kpiUserEvaluation.orgDnaId = :root AND kpiUserEvaluation.child1DnaId IS NOT NULL"); + // params.root = orgDna.rootDnaId; + // } + // } else if (level === 2) { + // conditions.push("kpiUserEvaluation.child1DnaId = :child1 AND kpiUserEvaluation.child2DnaId IS NOT NULL"); + // params.child1 = orgDna.child1DnaId; + // } else if (level === 3) { + // conditions.push("kpiUserEvaluation.child2DnaId = :child2 AND kpiUserEvaluation.child3DnaId IS NOT NULL"); + // params.child2 = orgDna.child2DnaId; + // } else if (level === 4) { + // conditions.push("kpiUserEvaluation.child3DnaId = :child3 AND kpiUserEvaluation.child4DnaId IS NOT NULL"); + // params.child3 = orgDna.child3DnaId; + // } - if (conditions.length > 0) { - typeCondition = { - query: conditions.join(" AND "), - params, - }; - } - } - } else if (_data.privilege === "OWNER" || _data.privilege === "ROOT") { + // if (conditions.length > 0) { + // typeCondition = { + // query: conditions.join(" AND "), + // params, + // }; + // } + // } + } else if (_data.privilege === "OWNER" || _data.privilege === "ROOT" || _data.privilege === "PARENT") { if (orgDna.rootDnaId) { conditions.push("kpiUserEvaluation.orgDnaId = :root"); params.root = orgDna.rootDnaId; diff --git a/src/interfaces/permission.ts b/src/interfaces/permission.ts index 09c517a..24bc8df 100644 --- a/src/interfaces/permission.ts +++ b/src/interfaces/permission.ts @@ -96,8 +96,10 @@ class CheckAuth { }; } else if (privilege == "PARENT") { data = { - root: [x.orgRootId], - child1: [null], + // root: [x.orgRootId], + // child1: [null], + root: null, + child1: null, child2: null, child3: null, child4: null,