fix พ้นพนักงาน
This commit is contained in:
parent
5f53769292
commit
5d4727761f
1 changed files with 20 additions and 14 deletions
|
|
@ -1718,25 +1718,25 @@ export class ProfileEmployeeController extends Controller {
|
|||
if (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) {
|
||||
orgChild1 = await this.child1Repository.findOne({where: { id: nodeId }});
|
||||
if (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) {
|
||||
orgChild2 = await this.child2Repository.findOne({where: { id: nodeId }});
|
||||
if (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) {
|
||||
orgChild3 = await this.child3Repository.findOne({where: { id: nodeId }});
|
||||
if (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) {
|
||||
orgChild4 = await this.child4Repository.findOne({where: { id: nodeId }});
|
||||
if (orgChild4) {
|
||||
|
|
@ -1750,27 +1750,32 @@ export class ProfileEmployeeController extends Controller {
|
|||
if (orgRootPms) {
|
||||
pmsCondition = "profileSalary.orgRoot = :orgRoot";
|
||||
}
|
||||
if (isAll == false) nodeAll = " AND profileSalary.orgChild1 IS NULL";
|
||||
} else if (_data.child1) {
|
||||
orgChild1Pms = await this.child1Repository.findOne({where: { id: _data.child1 }});
|
||||
if (orgChild1Pms) {
|
||||
pmsCondition = "profileSalary.orgChild1 = :orgChild1";
|
||||
}
|
||||
if (isAll == false) nodeAll = " AND profileSalary.orgChild2 IS NULL";
|
||||
} else if (_data.child2) {
|
||||
orgChild2Pms = await this.child2Repository.findOne({where: { id: _data.child2 }});
|
||||
if (orgChild2Pms) {
|
||||
pmsCondition = "profileSalary.orgChild2 = :orgChild2";
|
||||
}
|
||||
if (isAll == false) nodeAll = " AND profileSalary.orgChild3 IS NULL";
|
||||
} else if (_data.child3) {
|
||||
orgChild3Pms = await this.child3Repository.findOne({where: { id: _data.child3 }});
|
||||
if (orgChild3Pms) {
|
||||
pmsCondition = "profileSalary.orgChild3 = :orgChild3";
|
||||
}
|
||||
if (isAll == false) nodeAll = " AND profileSalary.orgChild4 IS NULL";
|
||||
} else if (_data.child4) {
|
||||
orgChild4Pms = await this.child4Repository.findOne({where: { id: _data.child4 }});
|
||||
if (orgChild4Pms) {
|
||||
pmsCondition = "profileSalary.orgChild4 = :orgChild4";
|
||||
}
|
||||
}
|
||||
pmsCondition = pmsCondition + nodeAll;
|
||||
// const findRevision = await this.orgRevisionRepo.findOne({
|
||||
// where: { orgRevisionIsCurrent: true },
|
||||
// });
|
||||
|
|
@ -1800,6 +1805,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
.orWhere("profileEmployee.isRetirement = :isRetirement", { isRetirement: true });
|
||||
})
|
||||
)
|
||||
.andWhere("profileEmployee.leaveCommandId Is NOT NULL")
|
||||
.andWhere("profileSalary.order = (SELECT MAX(ps.order) FROM profileSalary ps WHERE ps.profileEmployeeId = profileEmployee.id)")
|
||||
|
||||
// .andWhere(
|
||||
|
|
@ -1885,19 +1891,19 @@ export class ProfileEmployeeController extends Controller {
|
|||
},
|
||||
)
|
||||
.andWhere(pmsCondition, {
|
||||
orgRoot: orgRootPms ? orgRootPms.orgRootName : undefined,
|
||||
orgChild1: orgChild1Pms ? orgChild1Pms.orgChild1Name : undefined,
|
||||
orgChild2: orgChild2Pms ? orgChild2Pms.orgChild2Name : undefined,
|
||||
orgChild3: orgChild3Pms ? orgChild3Pms.orgChild3Name : undefined,
|
||||
orgChild4: orgChild4Pms ? orgChild4Pms.orgChild4Name : undefined,
|
||||
orgRootPms: orgRootPms ? orgRootPms.orgRootName : "",
|
||||
orgChild1Pms: orgChild1Pms ? orgChild1Pms.orgChild1Name : "",
|
||||
orgChild2Pms: orgChild2Pms ? orgChild2Pms.orgChild2Name : "",
|
||||
orgChild3Pms: orgChild3Pms ? orgChild3Pms.orgChild3Name : "",
|
||||
orgChild4Pms: orgChild4Pms ? orgChild4Pms.orgChild4Name : "",
|
||||
})
|
||||
|
||||
.andWhere(nodeCondition, {
|
||||
orgRoot: orgRoot ? orgRoot.orgRootName : undefined,
|
||||
orgChild1: orgChild1 ? orgChild1.orgChild1Name : undefined,
|
||||
orgChild2: orgChild2 ? orgChild2.orgChild2Name : undefined,
|
||||
orgChild3: orgChild3 ? orgChild3.orgChild3Name : undefined,
|
||||
orgChild4: orgChild4 ? orgChild4.orgChild4Name : undefined,
|
||||
orgRoot: orgRoot ? orgRoot.orgRootName : "",
|
||||
orgChild1: orgChild1 ? orgChild1.orgChild1Name : "",
|
||||
orgChild2: orgChild2 ? orgChild2.orgChild2Name : "",
|
||||
orgChild3: orgChild3 ? orgChild3.orgChild3Name : "",
|
||||
orgChild4: orgChild4 ? orgChild4.orgChild4Name : "",
|
||||
})
|
||||
// .andWhere(`current_holders.orgRevisionId LIKE :orgRevisionId`, {
|
||||
// orgRevisionId: findRevision.id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue