เพิ่มฟิลด์ org
This commit is contained in:
parent
d431bbaf3a
commit
85252f05c3
1 changed files with 78 additions and 1 deletions
|
|
@ -640,6 +640,10 @@ export class OrganizationUnauthorizeController extends Controller {
|
||||||
.createQueryBuilder("profile")
|
.createQueryBuilder("profile")
|
||||||
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||||
.leftJoinAndSelect("current_holders.orgRoot", "orgRoot")
|
.leftJoinAndSelect("current_holders.orgRoot", "orgRoot")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild1", "orgChild1")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||||
.leftJoinAndSelect("current_holders.positions", "positions")
|
.leftJoinAndSelect("current_holders.positions", "positions")
|
||||||
.leftJoinAndSelect("positions.posExecutive", "posExecutive")
|
.leftJoinAndSelect("positions.posExecutive", "posExecutive")
|
||||||
.where({ citizenId: id })
|
.where({ citizenId: id })
|
||||||
|
|
@ -678,12 +682,47 @@ export class OrganizationUnauthorizeController extends Controller {
|
||||||
findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null
|
findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null
|
||||||
? null
|
? null
|
||||||
: findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
: findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||||
|
|
||||||
|
const child1 =
|
||||||
|
findProfile.current_holders == null ||
|
||||||
|
findProfile.current_holders.length == 0 ||
|
||||||
|
findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null
|
||||||
|
? null
|
||||||
|
: findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild1;
|
||||||
|
|
||||||
|
const child2 =
|
||||||
|
findProfile.current_holders == null ||
|
||||||
|
findProfile.current_holders.length == 0 ||
|
||||||
|
findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null
|
||||||
|
? null
|
||||||
|
: findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild2;
|
||||||
|
|
||||||
|
const child3 =
|
||||||
|
findProfile.current_holders == null ||
|
||||||
|
findProfile.current_holders.length == 0 ||
|
||||||
|
findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null
|
||||||
|
? null
|
||||||
|
: findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3;
|
||||||
|
|
||||||
|
const child4 =
|
||||||
|
findProfile.current_holders == null ||
|
||||||
|
findProfile.current_holders.length == 0 ||
|
||||||
|
findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null
|
||||||
|
? null
|
||||||
|
: findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4;
|
||||||
|
|
||||||
|
let _child1 = child1 == null ? "" : `${child1.orgChild1Name}/`
|
||||||
|
let _child2 = child2 == null ? "" : `${child2.orgChild2Name}/`
|
||||||
|
let _child3 = child3 == null ? "" : `${child3.orgChild3Name}/`
|
||||||
|
let _child4 = child4 == null ? "" : `${child4.orgChild4Name}/`
|
||||||
|
|
||||||
return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
rootId: root == null ? null : root.id,
|
rootId: root == null ? null : root.id,
|
||||||
root: root == null ? null : root.orgRootName,
|
root: root == null ? null : root.orgRootName,
|
||||||
orgRootShortName: root == null ? null : root.orgRootShortName,
|
orgRootShortName: root == null ? null : root.orgRootShortName,
|
||||||
orgRevisionId: findRevision.id,
|
orgRevisionId: findRevision.id,
|
||||||
profileId: findProfile.id,
|
profileId: findProfile.id,
|
||||||
|
org: `${_child4}${_child3}${_child2}${_child1}${root?.orgRootName}`,
|
||||||
type: "OFFICER",
|
type: "OFFICER",
|
||||||
rank: findProfile.rank,
|
rank: findProfile.rank,
|
||||||
prefix: findProfile.prefix,
|
prefix: findProfile.prefix,
|
||||||
|
|
@ -716,8 +755,12 @@ export class OrganizationUnauthorizeController extends Controller {
|
||||||
.createQueryBuilder("profile")
|
.createQueryBuilder("profile")
|
||||||
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||||
.leftJoinAndSelect("current_holders.orgRoot", "orgRoot")
|
.leftJoinAndSelect("current_holders.orgRoot", "orgRoot")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild1", "orgChild1")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||||
.leftJoinAndSelect("current_holders.positions", "positions")
|
.leftJoinAndSelect("current_holders.positions", "positions")
|
||||||
.leftJoinAndSelect("positions.posExecutive", "posExecutive")
|
// .leftJoinAndSelect("positions.posExecutive", "posExecutive")
|
||||||
.where({ citizenId: id })
|
.where({ citizenId: id })
|
||||||
.getOne();
|
.getOne();
|
||||||
if (!findProfile) {
|
if (!findProfile) {
|
||||||
|
|
@ -731,12 +774,46 @@ export class OrganizationUnauthorizeController extends Controller {
|
||||||
? null
|
? null
|
||||||
: findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
: findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||||
|
|
||||||
|
const child1 =
|
||||||
|
findProfile.current_holders == null ||
|
||||||
|
findProfile.current_holders.length == 0 ||
|
||||||
|
findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null
|
||||||
|
? null
|
||||||
|
: findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild1;
|
||||||
|
|
||||||
|
const child2 =
|
||||||
|
findProfile.current_holders == null ||
|
||||||
|
findProfile.current_holders.length == 0 ||
|
||||||
|
findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null
|
||||||
|
? null
|
||||||
|
: findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild2;
|
||||||
|
|
||||||
|
const child3 =
|
||||||
|
findProfile.current_holders == null ||
|
||||||
|
findProfile.current_holders.length == 0 ||
|
||||||
|
findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null
|
||||||
|
? null
|
||||||
|
: findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3;
|
||||||
|
|
||||||
|
const child4 =
|
||||||
|
findProfile.current_holders == null ||
|
||||||
|
findProfile.current_holders.length == 0 ||
|
||||||
|
findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null
|
||||||
|
? null
|
||||||
|
: findProfile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4;
|
||||||
|
|
||||||
|
let _child1 = child1 == null ? "" : `${child1.orgChild1Name}/`
|
||||||
|
let _child2 = child2 == null ? "" : `${child2.orgChild2Name}/`
|
||||||
|
let _child3 = child3 == null ? "" : `${child3.orgChild3Name}/`
|
||||||
|
let _child4 = child4 == null ? "" : `${child4.orgChild4Name}/`
|
||||||
|
|
||||||
return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
rootId: root == null ? null : root.id,
|
rootId: root == null ? null : root.id,
|
||||||
root: root == null ? null : root.orgRootName,
|
root: root == null ? null : root.orgRootName,
|
||||||
orgRootShortName: root == null ? null : root.orgRootShortName,
|
orgRootShortName: root == null ? null : root.orgRootShortName,
|
||||||
orgRevisionId: findRevision.id,
|
orgRevisionId: findRevision.id,
|
||||||
profileId: findProfile.id,
|
profileId: findProfile.id,
|
||||||
|
org: `${_child4}${_child3}${_child2}${_child1}${root?.orgRootName}`,
|
||||||
type: "EMPLOYEE",
|
type: "EMPLOYEE",
|
||||||
rank: findProfile.rank,
|
rank: findProfile.rank,
|
||||||
prefix: findProfile.prefix,
|
prefix: findProfile.prefix,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue