95 lines
5.2 KiB
TypeScript
95 lines
5.2 KiB
TypeScript
import { ViewColumn, ViewEntity } from "typeorm";
|
|
|
|
@ViewEntity({
|
|
expression: `SELECT
|
|
\`profileChild\`.\`id\` AS \`Id\`,
|
|
\`profileChild\`.\`prefix\` AS \`prefix\`,
|
|
\`profileChild\`.\`firstName\` AS \`firstName\`,
|
|
\`profileChild\`.\`lastName\` AS \`lastName\`,
|
|
\`profileChild\`.\`citizenId\` AS \`citizenId\`,
|
|
\`profileChild\`.\`position\` AS \`position\`,
|
|
CONCAT((CASE
|
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`orgRootChild\`.\`orgRootShortName\`
|
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`orgChild1Child\`.\`orgChild1ShortName\`
|
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`orgChild2Child\`.\`orgChild2ShortName\`
|
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`orgChild3Child\`.\`orgChild3ShortName\`
|
|
ELSE \`orgChild4Child\`.\`orgChild4ShortName\`
|
|
END),
|
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
|
|
\`posMasterChild\`.\`isDirector\` AS \`isDirectorChild\`,
|
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`isDirector\` AS \`isDirector\`,
|
|
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
|
|
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
|
|
NULL AS \`posExecutiveName\`,
|
|
\`bma_ehr_organization_demo\`.\`orgRoot\`.\`isDeputy\` AS \`isDeputy\`,
|
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
|
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` AS \`orgChild1Id\`,
|
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` AS \`orgChild2Id\`,
|
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` AS \`orgChild3Id\`,
|
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` AS \`orgChild4Id\`,
|
|
CONCAT(\`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`,
|
|
\`profileChild\`.\`id\`) AS \`key\`,
|
|
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
|
|
CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
|
|
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
|
|
' ',
|
|
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\`) AS \`actFullName\`
|
|
FROM
|
|
((((((((((((\`bma_ehr_organization_demo\`.\`posMasterAct\`
|
|
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` \`posMasterChild\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`)))
|
|
JOIN \`bma_ehr_organization_demo\`.\`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`)))
|
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` \`orgRootChild\` ON ((\`posMasterChild\`.\`orgRootId\` = \`orgRootChild\`.\`id\`)))
|
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` \`orgChild1Child\` ON ((\`posMasterChild\`.\`orgChild1Id\` = \`orgChild1Child\`.\`id\`)))
|
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` \`orgChild2Child\` ON ((\`posMasterChild\`.\`orgChild2Id\` = \`orgChild2Child\`.\`id\`)))
|
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` \`orgChild3Child\` ON ((\`posMasterChild\`.\`orgChild3Id\` = \`orgChild3Child\`.\`id\`)))
|
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` \`orgChild4Child\` ON ((\`posMasterChild\`.\`orgChild4Id\` = \`orgChild4Child\`.\`id\`)))
|
|
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`profileChild\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
|
|
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`profileChild\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))
|
|
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterId\` = \`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`)))
|
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` = \`bma_ehr_organization_demo\`.\`orgRoot\`.\`id\`)))
|
|
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))`,
|
|
})
|
|
export class viewDirectorActing {
|
|
@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()
|
|
isDirectorChild: 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;
|
|
}
|