Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 53s

This commit is contained in:
harid 2026-02-19 15:16:58 +07:00
commit 0f0105a2d7
3 changed files with 72 additions and 65 deletions

View file

@ -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,

View file

@ -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;

View file

@ -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,