สิทธิ์ดูโครงสร้าง
This commit is contained in:
parent
ef26d0f305
commit
58274b479c
1 changed files with 39 additions and 470 deletions
|
|
@ -42,6 +42,7 @@ import {
|
|||
CreatePosMasterHistoryEmployee,
|
||||
CreatePosMasterHistoryOfficer,
|
||||
} from "../services/PositionService";
|
||||
|
||||
@Route("api/v1/org")
|
||||
@Tags("Organization")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -1962,34 +1963,41 @@ export class OrganizationController extends Controller {
|
|||
child3: null,
|
||||
child4: null,
|
||||
};
|
||||
let _data1: any = {
|
||||
root: null,
|
||||
};
|
||||
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({ where: { id } });
|
||||
|
||||
if (!orgRevision) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
let attrOwnership = null;
|
||||
let _privilege = await new permission().PermissionOrgList(request, "SYS_ORG");
|
||||
attrOwnership = _privilege.root == null ? true : false;
|
||||
if (
|
||||
orgRevision.orgRevisionIsDraft == true &&
|
||||
orgRevision.orgRevisionIsCurrent == false &&
|
||||
attrOwnership == false
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { keycloak: request.user.sub },
|
||||
relations: ["permissionProfiles"],
|
||||
});
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งานในทะเบียนประวัติ");
|
||||
const attrOwnership = _privilege.root === null ? true : false;
|
||||
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { keycloak: request.user.sub },
|
||||
relations: ["permissionProfiles", "current_holders", "current_holders.posMasterAssigns"],
|
||||
});
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งานในทะเบียนประวัติ");
|
||||
}
|
||||
let profileAssign = profile.current_holders
|
||||
?.find((x) => x.orgRevisionId === id)
|
||||
?.posMasterAssigns.find((x) => x.assignId === "SYS_ORG");
|
||||
|
||||
if (orgRevision.orgRevisionIsDraft && !orgRevision.orgRevisionIsCurrent && !attrOwnership) {
|
||||
_data.root = profile.permissionProfiles.map((x) => x.orgRootId);
|
||||
}
|
||||
// กำหนดการเข้าถึงข้อมูลตามสถานะและสิทธิ์
|
||||
const isCurrentActive = !orgRevision.orgRevisionIsDraft && orgRevision.orgRevisionIsCurrent;
|
||||
|
||||
if (isCurrentActive) {
|
||||
if (profileAssign) {
|
||||
_data.root = [profile.current_holders.find((x) => x.orgRevisionId === id)?.orgRootId];
|
||||
} else {
|
||||
if (!attrOwnership) _data = _privilege;
|
||||
}
|
||||
_data = {
|
||||
root: profile.permissionProfiles.map((x) => x.orgRootId),
|
||||
child1: null,
|
||||
child2: null,
|
||||
child3: null,
|
||||
child4: null,
|
||||
};
|
||||
}
|
||||
|
||||
const _revision = await this.orgRevisionRepository.findOne({
|
||||
|
|
@ -2001,8 +2009,8 @@ export class OrganizationController extends Controller {
|
|||
.createQueryBuilder("orgRoot")
|
||||
.where("orgRoot.orgRevisionId = :id", { id })
|
||||
.andWhere(
|
||||
_data.root != undefined && _data.root != null
|
||||
? _data.root[0] != null
|
||||
_data.root !== undefined && _data.root !== null
|
||||
? _data.root[0] !== null
|
||||
? `orgRoot.id IN (:...node)`
|
||||
: `orgRoot.id is null`
|
||||
: "1=1",
|
||||
|
|
@ -2040,8 +2048,8 @@ export class OrganizationController extends Controller {
|
|||
.createQueryBuilder("orgChild1")
|
||||
.where("orgChild1.orgRootId IN (:...ids)", { ids: orgRootIds })
|
||||
.andWhere(
|
||||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
_data.child1 !== undefined && _data.child1 !== null
|
||||
? _data.child1[0] !== null
|
||||
? `orgChild1.id IN (:...node)`
|
||||
: `orgChild1.id is null`
|
||||
: "1=1",
|
||||
|
|
@ -2081,8 +2089,8 @@ export class OrganizationController extends Controller {
|
|||
.createQueryBuilder("orgChild2")
|
||||
.where("orgChild2.orgChild1Id IN (:...ids)", { ids: orgChild1Ids })
|
||||
.andWhere(
|
||||
_data.child2 != undefined && _data.child2 != null
|
||||
? _data.child2[0] != null
|
||||
_data.child2 !== undefined && _data.child2 !== null
|
||||
? _data.child2[0] !== null
|
||||
? `orgChild2.id IN (:...node)`
|
||||
: `orgChild2.id is null`
|
||||
: "1=1",
|
||||
|
|
@ -2121,8 +2129,8 @@ export class OrganizationController extends Controller {
|
|||
.createQueryBuilder("orgChild3")
|
||||
.where("orgChild3.orgChild2Id IN (:...ids)", { ids: orgChild2Ids })
|
||||
.andWhere(
|
||||
_data.child3 != undefined && _data.child3 != null
|
||||
? _data.child3[0] != null
|
||||
_data.child3 !== undefined && _data.child3 !== null
|
||||
? _data.child3[0] !== null
|
||||
? `orgChild3.id IN (:...node)`
|
||||
: `orgChild3.id is null`
|
||||
: "1=1",
|
||||
|
|
@ -2161,8 +2169,8 @@ export class OrganizationController extends Controller {
|
|||
.createQueryBuilder("orgChild4")
|
||||
.where("orgChild4.orgChild3Id IN (:...ids)", { ids: orgChild3Ids })
|
||||
.andWhere(
|
||||
_data.child4 != undefined && _data.child4 != null
|
||||
? _data.child4[0] != null
|
||||
_data.child4 !== undefined && _data.child4 !== null
|
||||
? _data.child4[0] !== null
|
||||
? `orgChild4.id IN (:...node)`
|
||||
: `orgChild4.id is null`
|
||||
: "1=1",
|
||||
|
|
@ -2194,7 +2202,6 @@ export class OrganizationController extends Controller {
|
|||
.getMany()
|
||||
: [];
|
||||
|
||||
// const formattedData = orgRootData.map((orgRoot) => {
|
||||
const formattedData = await Promise.all(
|
||||
orgRootData.map(async (orgRoot) => {
|
||||
return {
|
||||
|
|
@ -2223,91 +2230,6 @@ export class OrganizationController extends Controller {
|
|||
responsibility: orgRoot.responsibility,
|
||||
labelName:
|
||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
||||
// totalPosition: await this.posMasterRepository.count({
|
||||
// where: { orgRevisionId: orgRoot.orgRevisionId, orgRootId: orgRoot.id },
|
||||
// }),
|
||||
// totalPositionCurrentUse: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgRootId: orgRoot.id,
|
||||
// current_holderId: Not(IsNull()) || Not(""),
|
||||
// },
|
||||
// }),
|
||||
// totalPositionCurrentVacant: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgRootId: orgRoot.id,
|
||||
// current_holderId: IsNull() || "",
|
||||
// },
|
||||
// }),
|
||||
// totalPositionNextUse: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgRootId: orgRoot.id,
|
||||
// next_holderId: Not(IsNull()) || Not(""),
|
||||
// },
|
||||
// }),
|
||||
// totalPositionNextVacant: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgRootId: orgRoot.id,
|
||||
// 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(
|
||||
orgChild1Data
|
||||
|
|
@ -2352,91 +2274,6 @@ export class OrganizationController extends Controller {
|
|||
"00" +
|
||||
" " +
|
||||
orgRoot.orgRootShortName,
|
||||
// totalPosition: await this.posMasterRepository.count({
|
||||
// where: { orgRevisionId: orgRoot.orgRevisionId, orgChild1Id: orgChild1.id },
|
||||
// }),
|
||||
// totalPositionCurrentUse: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild1Id: orgChild1.id,
|
||||
// current_holderId: Not(IsNull()) || Not(""),
|
||||
// },
|
||||
// }),
|
||||
// totalPositionCurrentVacant: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild1Id: orgChild1.id,
|
||||
// current_holderId: IsNull() || "",
|
||||
// },
|
||||
// }),
|
||||
// totalPositionNextUse: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild1Id: orgChild1.id,
|
||||
// next_holderId: Not(IsNull()) || Not(""),
|
||||
// },
|
||||
// }),
|
||||
// totalPositionNextVacant: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild1Id: orgChild1.id,
|
||||
// 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(
|
||||
orgChild2Data
|
||||
|
|
@ -2486,94 +2323,6 @@ export class OrganizationController extends Controller {
|
|||
"00" +
|
||||
" " +
|
||||
orgRoot.orgRootShortName,
|
||||
// totalPosition: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild2Id: orgChild2.id,
|
||||
// },
|
||||
// }),
|
||||
// totalPositionCurrentUse: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild2Id: orgChild2.id,
|
||||
// current_holderId: Not(IsNull()) || Not(""),
|
||||
// },
|
||||
// }),
|
||||
// totalPositionCurrentVacant: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild2Id: orgChild2.id,
|
||||
// current_holderId: IsNull() || "",
|
||||
// },
|
||||
// }),
|
||||
// totalPositionNextUse: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild2Id: orgChild2.id,
|
||||
// next_holderId: Not(IsNull()) || Not(""),
|
||||
// },
|
||||
// }),
|
||||
// totalPositionNextVacant: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild2Id: orgChild2.id,
|
||||
// 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(
|
||||
orgChild3Data
|
||||
|
|
@ -2630,94 +2379,6 @@ export class OrganizationController extends Controller {
|
|||
"00" +
|
||||
" " +
|
||||
orgRoot.orgRootShortName,
|
||||
// totalPosition: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild3Id: orgChild3.id,
|
||||
// },
|
||||
// }),
|
||||
// totalPositionCurrentUse: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild3Id: orgChild3.id,
|
||||
// current_holderId: Not(IsNull()) || Not(""),
|
||||
// },
|
||||
// }),
|
||||
// totalPositionCurrentVacant: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild3Id: orgChild3.id,
|
||||
// current_holderId: IsNull() || "",
|
||||
// },
|
||||
// }),
|
||||
// totalPositionNextUse: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild3Id: orgChild3.id,
|
||||
// next_holderId: Not(IsNull()) || Not(""),
|
||||
// },
|
||||
// }),
|
||||
// totalPositionNextVacant: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild3Id: orgChild3.id,
|
||||
// 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(
|
||||
orgChild4Data
|
||||
|
|
@ -2781,99 +2442,6 @@ export class OrganizationController extends Controller {
|
|||
"00" +
|
||||
" " +
|
||||
orgRoot.orgRootShortName,
|
||||
// totalPosition: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild4Id: orgChild4.id,
|
||||
// },
|
||||
// }),
|
||||
// totalPositionCurrentUse: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild4Id: orgChild4.id,
|
||||
// current_holderId: Not(IsNull()) || Not(""),
|
||||
// },
|
||||
// }),
|
||||
// totalPositionCurrentVacant: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild4Id: orgChild4.id,
|
||||
// current_holderId: IsNull() || "",
|
||||
// },
|
||||
// }),
|
||||
// totalPositionNextUse: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild4Id: orgChild4.id,
|
||||
// next_holderId: Not(IsNull()) || Not(""),
|
||||
// },
|
||||
// }),
|
||||
// totalPositionNextVacant: await this.posMasterRepository.count({
|
||||
// where: {
|
||||
// orgRevisionId: orgRoot.orgRevisionId,
|
||||
// orgChild4Id: orgChild4.id,
|
||||
// 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() || "",
|
||||
// },
|
||||
// },
|
||||
// ),
|
||||
})),
|
||||
),
|
||||
})),
|
||||
|
|
@ -2886,6 +2454,7 @@ export class OrganizationController extends Controller {
|
|||
}),
|
||||
);
|
||||
|
||||
// return new HttpSuccess({ remark: _revision.remark, data: formattedData });
|
||||
return new HttpSuccess({ remark: _revision.remark, data: formattedData });
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue