This commit is contained in:
Bright 2025-04-02 18:11:35 +07:00
parent 2faf631f7b
commit 8c2de2e7bf

View file

@ -2638,7 +2638,7 @@ export class CommandController extends Controller {
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
current_holderId: Not(IsNull()),
},
relations: ["current_holder", "orgRoot", "positions"],
relations: ["current_holder", "orgRoot", "orgChild1", "positions"],
order: { posMasterOrder: "ASC" },
});
if (_posMasterOfficer) {
@ -2647,7 +2647,13 @@ export class CommandController extends Controller {
prefix: _posMasterOfficer?.current_holder.prefix,
firstName: _posMasterOfficer?.current_holder.firstName,
lastName: _posMasterOfficer?.current_holder.lastName,
organizationName: _posMasterOfficer.orgRoot ? _posMasterOfficer.orgRoot.orgRootName : _null,
// organizationName: _posMasterOfficer.orgRoot ? _posMasterOfficer.orgRoot.orgRootName : _null,
organizationName: _posMasterOfficer.orgChild1
? _posMasterOfficer.orgChild1.orgChild1Name + "\n" +
_posMasterOfficer.orgRoot.orgRootName
: _posMasterOfficer.orgChild1 == null && _posMasterOfficer.orgRoot
? _posMasterOfficer.orgRoot.orgRootName
: _null,
positionName: _posMasterOfficer?.current_holder.position ?? _null,
profileId: _posMasterOfficer?.current_holder.id ?? _null,
});
@ -2737,7 +2743,7 @@ export class CommandController extends Controller {
current_holderId: Not(IsNull()),
},
],
relations: ["current_holder", "orgRoot"],
relations: ["current_holder", "orgChild1", "orgChild2", "orgChild3", "orgChild4"],
});
if (_posMaster.length > 0) {
_posMaster.forEach((x: any) => {
@ -2746,7 +2752,16 @@ export class CommandController extends Controller {
prefix: x?.current_holder.prefix,
firstName: x?.current_holder.firstName,
lastName: x?.current_holder.lastName,
organizationName: x.orgRoot ? x.orgRoot.orgRootName : _null,
// organizationName: x.orgRoot ? x.orgRoot.orgRootName : _null,
organizationName: x.orgChild1 == null
? x.orgRoot.orgRootName
: x.orgChild2 == null
? x.orgChild1.orgChild1Name + "\n" + x.orgRoot.orgRootName
: x.orgChild3 == null
? x.orgChil2.orgChild2Name + "\n" + x.orgChild1.orgChild1Name + "\n" + x.orgRoot.orgRootName
: x.orgChild4 == null
? x.orgChil3.orgChild3Name + "\n" + x.orgChil2.orgChild2Name + "\n" + x.orgChild1.orgChild1Name + "\n" + x.orgRoot.orgRootName
: x.orgChil4.orgChild4Name,
positionName: x?.current_holder.position ?? _null,
profileId: x?.current_holder.id ?? _null,
});