134 lines
5.5 KiB
TypeScript
134 lines
5.5 KiB
TypeScript
import { ViewColumn, ViewEntity } from "typeorm";
|
|
|
|
@ViewEntity({
|
|
expression: `SELECT
|
|
\`profile\`.\`id\` AS \`Id\`,
|
|
\`profile\`.\`prefix\` AS \`prefix\`,
|
|
\`profile\`.\`firstName\` AS \`firstName\`,
|
|
\`profile\`.\`lastName\` AS \`lastName\`,
|
|
\`profile\`.\`citizenId\` AS \`citizenId\`,
|
|
\`profile\`.\`position\` AS \`position\`,
|
|
CONCAT((CASE
|
|
WHEN (\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`orgRoot\`.\`orgRootShortName\`
|
|
WHEN (\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`orgChild1\`.\`orgChild1ShortName\`
|
|
WHEN (\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`orgChild2\`.\`orgChild2ShortName\`
|
|
WHEN (\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`orgChild3\`.\`orgChild3ShortName\`
|
|
ELSE \`orgChild4\`.\`orgChild4ShortName\`
|
|
END),
|
|
\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
|
|
\`posMaster\`.\`isDirector\` AS \`isDirector\`,
|
|
\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
|
|
\`posType\`.\`posTypeName\` AS \`posType\`,
|
|
\`posExecutive\`.\`posExecutiveName\` AS \`posExecutiveName\`,
|
|
\`orgRoot\`.\`isDeputy\` AS \`isDeputy\`,
|
|
\`orgChild1\`.\`isOfficer\` AS \`isOfficer\`,
|
|
\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
|
|
\`posMaster\`.\`orgChild1Id\` AS \`orgChild1Id\`,
|
|
\`posMaster\`.\`orgChild2Id\` AS \`orgChild2Id\`,
|
|
\`posMaster\`.\`orgChild3Id\` AS \`orgChild3Id\`,
|
|
\`posMaster\`.\`orgChild4Id\` AS \`orgChild4Id\`,
|
|
CONCAT(\`posMaster\`.\`id\`, \`profile\`.\`id\`) AS \`key\`,
|
|
(
|
|
SELECT \`actFullNameId\`
|
|
FROM \`view_director_acting\` AS \`acting\`
|
|
WHERE \`acting\`.\`Id\` = \`posMaster\`.\`current_holderId\`
|
|
AND \`acting\`.\`orgRootId\` = \`posMaster\`.\`orgRootId\`
|
|
AND (
|
|
(\`acting\`.\`orgChild1Id\` IS NULL AND \`posMaster\`.\`orgChild1Id\` IS NULL)
|
|
OR (\`acting\`.\`orgChild1Id\` = \`posMaster\`.\`orgChild1Id\`)
|
|
)
|
|
AND (
|
|
(\`acting\`.\`orgChild2Id\` IS NULL AND \`posMaster\`.\`orgChild2Id\` IS NULL)
|
|
OR (\`acting\`.\`orgChild2Id\` = \`posMaster\`.\`orgChild2Id\`)
|
|
)
|
|
AND (
|
|
(\`acting\`.\`orgChild3Id\` IS NULL AND \`posMaster\`.\`orgChild3Id\` IS NULL)
|
|
OR (\`acting\`.\`orgChild3Id\` = \`posMaster\`.\`orgChild3Id\`)
|
|
)
|
|
AND (
|
|
(\`acting\`.\`orgChild4Id\` IS NULL AND \`posMaster\`.\`orgChild4Id\` IS NULL)
|
|
OR (\`acting\`.\`orgChild4Id\` = \`posMaster\`.\`orgChild4Id\`)
|
|
)
|
|
) AS \`actFullNameId\`,
|
|
(
|
|
SELECT \`actFullName\`
|
|
FROM \`view_director_acting\` AS \`acting\`
|
|
WHERE \`acting\`.\`Id\` = \`posMaster\`.\`current_holderId\`
|
|
AND \`acting\`.\`orgRootId\` = \`posMaster\`.\`orgRootId\`
|
|
AND (
|
|
(\`acting\`.\`orgChild1Id\` IS NULL AND \`posMaster\`.\`orgChild1Id\` IS NULL)
|
|
OR (\`acting\`.\`orgChild1Id\` = \`posMaster\`.\`orgChild1Id\`)
|
|
)
|
|
AND (
|
|
(\`acting\`.\`orgChild2Id\` IS NULL AND \`posMaster\`.\`orgChild2Id\` IS NULL)
|
|
OR (\`acting\`.\`orgChild2Id\` = \`posMaster\`.\`orgChild2Id\`)
|
|
)
|
|
AND (
|
|
(\`acting\`.\`orgChild3Id\` IS NULL AND \`posMaster\`.\`orgChild3Id\` IS NULL)
|
|
OR (\`acting\`.\`orgChild3Id\` = \`posMaster\`.\`orgChild3Id\`)
|
|
)
|
|
AND (
|
|
(\`acting\`.\`orgChild4Id\` IS NULL AND \`posMaster\`.\`orgChild4Id\` IS NULL)
|
|
OR (\`acting\`.\`orgChild4Id\` = \`posMaster\`.\`orgChild4Id\`)
|
|
)
|
|
) AS \`actFullName\`
|
|
|
|
FROM
|
|
((((((((((\`posMaster\`
|
|
JOIN \`profile\` ON ((\`posMaster\`.\`current_holderId\` = \`profile\`.\`id\`)))
|
|
LEFT JOIN \`orgRoot\` ON ((\`posMaster\`.\`orgRootId\` = \`orgRoot\`.\`id\`)))
|
|
LEFT JOIN \`orgChild1\` ON ((\`posMaster\`.\`orgChild1Id\` = \`orgChild1\`.\`id\`)))
|
|
LEFT JOIN \`orgChild2\` ON ((\`posMaster\`.\`orgChild2Id\` = \`orgChild2\`.\`id\`)))
|
|
LEFT JOIN \`orgChild3\` ON ((\`posMaster\`.\`orgChild3Id\` = \`orgChild3\`.\`id\`)))
|
|
LEFT JOIN \`orgChild4\` ON ((\`posMaster\`.\`orgChild4Id\` = \`orgChild4\`.\`id\`)))
|
|
JOIN \`posLevel\` ON ((\`profile\`.\`posLevelId\` = \`posLevel\`.\`id\`)))
|
|
JOIN \`posType\` ON ((\`profile\`.\`posTypeId\` = \`posType\`.\`id\`)))
|
|
LEFT JOIN \`position\` ON ((\`posMaster\`.\`id\` = \`position\`.\`posMasterId\`)))
|
|
LEFT JOIN \`posExecutive\` ON ((\`position\`.\`posExecutiveId\` = \`posExecutive\`.\`id\`)))
|
|
WHERE
|
|
(\`position\`.\`positionIsSelected\` = TRUE)`,
|
|
})
|
|
export class viewDirector {
|
|
@ViewColumn()
|
|
id: string;
|
|
@ViewColumn()
|
|
prefix: string;
|
|
@ViewColumn()
|
|
firstName: string;
|
|
@ViewColumn()
|
|
lastName: string;
|
|
@ViewColumn()
|
|
citizenId: string;
|
|
@ViewColumn()
|
|
position: string;
|
|
@ViewColumn()
|
|
posNo: string;
|
|
@ViewColumn()
|
|
posLevel: string;
|
|
@ViewColumn()
|
|
posType: string;
|
|
@ViewColumn()
|
|
posExecutiveName: string;
|
|
@ViewColumn()
|
|
isDirector: boolean;
|
|
@ViewColumn()
|
|
isDeputy: boolean;
|
|
@ViewColumn()
|
|
isOfficer: boolean;
|
|
@ViewColumn()
|
|
orgRootId: string;
|
|
@ViewColumn()
|
|
orgChild1Id: string;
|
|
@ViewColumn()
|
|
orgChild2Id: string;
|
|
@ViewColumn()
|
|
orgChild3Id: string;
|
|
@ViewColumn()
|
|
orgChild4Id: string;
|
|
@ViewColumn()
|
|
actFullNameId: string;
|
|
@ViewColumn()
|
|
actFullName: string;
|
|
@ViewColumn()
|
|
key: string;
|
|
}
|