This commit is contained in:
AdisakKanthawilang 2025-04-01 14:29:43 +07:00
parent 26ef28f5cf
commit 0a9fd9f07e

View file

@ -5582,25 +5582,25 @@ export class ProfileController extends Controller {
if (orgRoot) { if (orgRoot) {
nodeCondition = "profileSalary.orgRoot = :orgRoot"; nodeCondition = "profileSalary.orgRoot = :orgRoot";
} }
if (isAll == false) nodeAll = " AND profileSalary.orgChild1Id IS NULL"; if (isAll == false) nodeAll = " AND profileSalary.orgChild1 IS NULL";
} else if (node === 1 && nodeId) { } else if (node === 1 && nodeId) {
orgChild1 = await this.orgChild1Repo.findOne({where: { id: nodeId }}); orgChild1 = await this.orgChild1Repo.findOne({where: { id: nodeId }});
if (orgChild1) { if (orgChild1) {
nodeCondition = "profileSalary.orgChild1 = :orgChild1"; nodeCondition = "profileSalary.orgChild1 = :orgChild1";
} }
if (isAll == false) nodeAll = " AND profileSalary.orgChild2Id IS NULL"; if (isAll == false) nodeAll = " AND profileSalary.orgChild2 IS NULL";
} else if (node === 2 && nodeId) { } else if (node === 2 && nodeId) {
orgChild2 = await this.orgChild2Repo.findOne({where: { id: nodeId }}); orgChild2 = await this.orgChild2Repo.findOne({where: { id: nodeId }});
if (orgChild2) { if (orgChild2) {
nodeCondition = "profileSalary.orgChild2 = :orgChild2"; nodeCondition = "profileSalary.orgChild2 = :orgChild2";
} }
if (isAll == false) nodeAll = " AND profileSalary.orgChild3Id IS NULL"; if (isAll == false) nodeAll = " AND profileSalary.orgChild3 IS NULL";
} else if (node === 3 && nodeId) { } else if (node === 3 && nodeId) {
orgChild3 = await this.orgChild3Repo.findOne({where: { id: nodeId }}); orgChild3 = await this.orgChild3Repo.findOne({where: { id: nodeId }});
if (orgChild3) { if (orgChild3) {
nodeCondition = "profileSalary.orgChild3 = :orgChild3"; nodeCondition = "profileSalary.orgChild3 = :orgChild3";
} }
if (isAll == false) nodeAll = " AND profileSalary.orgChild4Id IS NULL"; if (isAll == false) nodeAll = " AND profileSalary.orgChild4 IS NULL";
} else if (node === 4 && nodeId) { } else if (node === 4 && nodeId) {
orgChild4 = await this.orgChild4Repo.findOne({where: { id: nodeId }}); orgChild4 = await this.orgChild4Repo.findOne({where: { id: nodeId }});
if (orgChild4) { if (orgChild4) {
@ -5614,28 +5614,32 @@ export class ProfileController extends Controller {
if (orgRootPms) { if (orgRootPms) {
pmsCondition = "profileSalary.orgRoot = :orgRoot"; pmsCondition = "profileSalary.orgRoot = :orgRoot";
} }
if (isAll == false) nodeAll = " AND profileSalary.orgChild1 IS NULL";
} else if (_data.child1) { } else if (_data.child1) {
orgChild1Pms = await this.orgChild1Repo.findOne({where: { id: _data.child1 }}); orgChild1Pms = await this.orgChild1Repo.findOne({where: { id: _data.child1 }});
if (orgChild1Pms) { if (orgChild1Pms) {
pmsCondition = "profileSalary.orgChild1 = :orgChild1"; pmsCondition = "profileSalary.orgChild1 = :orgChild1";
} }
if (isAll == false) nodeAll = " AND profileSalary.orgChild2 IS NULL";
} else if (_data.child2) { } else if (_data.child2) {
orgChild2Pms = await this.orgChild2Repo.findOne({where: { id: _data.child2 }}); orgChild2Pms = await this.orgChild2Repo.findOne({where: { id: _data.child2 }});
if (orgChild2Pms) { if (orgChild2Pms) {
pmsCondition = "profileSalary.orgChild2 = :orgChild2"; pmsCondition = "profileSalary.orgChild2 = :orgChild2";
} }
if (isAll == false) nodeAll = " AND profileSalary.orgChild3 IS NULL";
} else if (_data.child3) { } else if (_data.child3) {
orgChild3Pms = await this.orgChild3Repo.findOne({where: { id: _data.child3 }}); orgChild3Pms = await this.orgChild3Repo.findOne({where: { id: _data.child3 }});
if (orgChild3Pms) { if (orgChild3Pms) {
pmsCondition = "profileSalary.orgChild3 = :orgChild3"; pmsCondition = "profileSalary.orgChild3 = :orgChild3";
} }
if (isAll == false) nodeAll = " AND profileSalary.orgChild4 IS NULL";
} else if (_data.child4) { } else if (_data.child4) {
orgChild4Pms = await this.orgChild4Repo.findOne({where: { id: _data.child4 }}); orgChild4Pms = await this.orgChild4Repo.findOne({where: { id: _data.child4 }});
if (orgChild4Pms) { if (orgChild4Pms) {
pmsCondition = "profileSalary.orgChild4 = :orgChild4"; pmsCondition = "profileSalary.orgChild4 = :orgChild4";
} }
} }
pmsCondition = pmsCondition + nodeAll;
// const findRevision = await this.orgRevisionRepo.findOne({ // const findRevision = await this.orgRevisionRepo.findOne({
// where: { orgRevisionIsCurrent: true }, // where: { orgRevisionIsCurrent: true },