เพิ่มฟิลด์ totalRoot
This commit is contained in:
parent
f75d9356fd
commit
a9cfb2d847
1 changed files with 223 additions and 0 deletions
|
|
@ -752,6 +752,50 @@ export class OrganizationController extends Controller {
|
||||||
next_holderId: IsNull() || "",
|
next_holderId: IsNull() || "",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
totalRootPosition: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : IsNull() || "", orgChild2Id : IsNull() || "",
|
||||||
|
orgChild3Id : IsNull() || "", orgChild4Id : IsNull() || "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionCurrentUse: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : IsNull() || "", orgChild2Id : IsNull() || "",
|
||||||
|
orgChild3Id : IsNull() || "", orgChild4Id : IsNull() || "",
|
||||||
|
current_holderId: Not(IsNull()) || Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionCurrentVacant: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : IsNull() || "", orgChild2Id : IsNull() || "",
|
||||||
|
orgChild3Id : IsNull() || "", orgChild4Id : IsNull() || "",
|
||||||
|
current_holderId: IsNull() || "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionNextUse: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : IsNull() || "", orgChild2Id : IsNull() || "",
|
||||||
|
orgChild3Id : IsNull() || "", orgChild4Id : IsNull() || "",
|
||||||
|
next_holderId: Not(IsNull()) || Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionNextVacant: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : IsNull() || "", orgChild2Id : IsNull() || "",
|
||||||
|
orgChild3Id : IsNull() || "", orgChild4Id : IsNull() || "",
|
||||||
|
next_holderId: IsNull() || "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
children: await Promise.all(
|
children: await Promise.all(
|
||||||
orgChild1Data
|
orgChild1Data
|
||||||
|
|
@ -804,6 +848,51 @@ export class OrganizationController extends Controller {
|
||||||
next_holderId: IsNull() || "",
|
next_holderId: IsNull() || "",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
totalRootPosition: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : IsNull() || "",
|
||||||
|
orgChild3Id : IsNull() || "", orgChild4Id : IsNull() || "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionCurrentUse: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : IsNull() || "",
|
||||||
|
orgChild3Id : IsNull() || "", orgChild4Id : IsNull() || "",
|
||||||
|
current_holderId: Not(IsNull()) || Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionCurrentVacant: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : IsNull() || "",
|
||||||
|
orgChild3Id : IsNull() || "", orgChild4Id : IsNull() || "",
|
||||||
|
current_holderId: IsNull() || "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionNextUse: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : IsNull() || "",
|
||||||
|
orgChild3Id : IsNull() || "", orgChild4Id : IsNull() || "",
|
||||||
|
next_holderId: Not(IsNull()) || Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionNextVacant: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : IsNull() || "",
|
||||||
|
orgChild3Id : IsNull() || "", orgChild4Id : IsNull() || "",
|
||||||
|
next_holderId: IsNull() || "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
children: await Promise.all(
|
children: await Promise.all(
|
||||||
orgChild2Data
|
orgChild2Data
|
||||||
.filter((orgChild2) => orgChild2.orgChild1Id === orgChild1.id)
|
.filter((orgChild2) => orgChild2.orgChild1Id === orgChild1.id)
|
||||||
|
|
@ -858,6 +947,51 @@ export class OrganizationController extends Controller {
|
||||||
next_holderId: IsNull() || "",
|
next_holderId: IsNull() || "",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
totalRootPosition: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : orgChild2.id,
|
||||||
|
orgChild3Id : IsNull() || "", orgChild4Id : IsNull() || "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionCurrentUse: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : orgChild2.id,
|
||||||
|
orgChild3Id : IsNull() || "", orgChild4Id : IsNull() || "",
|
||||||
|
current_holderId: Not(IsNull()) || Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionCurrentVacant: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : orgChild2.id,
|
||||||
|
orgChild3Id : IsNull() || "", orgChild4Id : IsNull() || "",
|
||||||
|
current_holderId: IsNull() || "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionNextUse: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : orgChild2.id,
|
||||||
|
orgChild3Id : IsNull() || "", orgChild4Id : IsNull() || "",
|
||||||
|
next_holderId: Not(IsNull()) || Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionNextVacant: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : orgChild2.id,
|
||||||
|
orgChild3Id : IsNull() || "", orgChild4Id : IsNull() || "",
|
||||||
|
next_holderId: IsNull() || "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
children: await Promise.all(
|
children: await Promise.all(
|
||||||
orgChild3Data
|
orgChild3Data
|
||||||
.filter((orgChild3) => orgChild3.orgChild2Id === orgChild2.id)
|
.filter((orgChild3) => orgChild3.orgChild2Id === orgChild2.id)
|
||||||
|
|
@ -912,6 +1046,51 @@ export class OrganizationController extends Controller {
|
||||||
next_holderId: IsNull() || "",
|
next_holderId: IsNull() || "",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
totalRootPosition: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : orgChild2.id,
|
||||||
|
orgChild3Id : orgChild3.id, orgChild4Id : IsNull() || "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionCurrentUse: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : orgChild2.id,
|
||||||
|
orgChild3Id : orgChild3.id, orgChild4Id : IsNull() || "",
|
||||||
|
current_holderId: Not(IsNull()) || Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionCurrentVacant: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : orgChild2.id,
|
||||||
|
orgChild3Id : orgChild3.id, orgChild4Id : IsNull() || "",
|
||||||
|
current_holderId: IsNull() || "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionNextUse: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : orgChild2.id,
|
||||||
|
orgChild3Id : orgChild3.id, orgChild4Id : IsNull() || "",
|
||||||
|
next_holderId: Not(IsNull()) || Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionNextVacant: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : orgChild2.id,
|
||||||
|
orgChild3Id : orgChild3.id, orgChild4Id : IsNull() || "",
|
||||||
|
next_holderId: IsNull() || "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
children: await Promise.all(
|
children: await Promise.all(
|
||||||
orgChild4Data
|
orgChild4Data
|
||||||
.filter((orgChild4) => orgChild4.orgChild3Id === orgChild3.id)
|
.filter((orgChild4) => orgChild4.orgChild3Id === orgChild3.id)
|
||||||
|
|
@ -967,6 +1146,50 @@ export class OrganizationController extends Controller {
|
||||||
next_holderId: IsNull() || "",
|
next_holderId: IsNull() || "",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
totalRootPosition: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : orgChild2.id,
|
||||||
|
orgChild3Id : orgChild3.id, orgChild4Id : orgChild4.id,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionCurrentUse: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : orgChild2.id,
|
||||||
|
orgChild3Id : orgChild3.id, orgChild4Id : orgChild4.id,
|
||||||
|
current_holderId: Not(IsNull()) || Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionCurrentVacant: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : orgChild2.id,
|
||||||
|
orgChild3Id : orgChild3.id, orgChild4Id : orgChild4.id,
|
||||||
|
current_holderId: IsNull() || "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionNextUse: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : orgChild2.id,
|
||||||
|
orgChild3Id : orgChild3.id, orgChild4Id : orgChild4.id,
|
||||||
|
next_holderId: Not(IsNull()) || Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalRootPositionNextVacant: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
orgRootId: orgRoot.id,
|
||||||
|
orgChild1Id : orgChild1.id, orgChild2Id : orgChild2.id,
|
||||||
|
orgChild3Id : orgChild3.id, orgChild4Id : orgChild4.id,
|
||||||
|
next_holderId: IsNull() || "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
})),
|
})),
|
||||||
),
|
),
|
||||||
})),
|
})),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue