From c1d35afbbfe4e4249618c4fbc830e8685bdb1f79 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Mon, 4 Nov 2024 12:03:09 +0700 Subject: [PATCH] updated --- src/entities/view/viewDirector.ts | 45 ++++++++++++++++++++++ src/entities/view/viewDirectorActing.ts | 51 +++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 src/entities/view/viewDirector.ts create mode 100644 src/entities/view/viewDirectorActing.ts diff --git a/src/entities/view/viewDirector.ts b/src/entities/view/viewDirector.ts new file mode 100644 index 00000000..afae56c1 --- /dev/null +++ b/src/entities/view/viewDirector.ts @@ -0,0 +1,45 @@ +import { ViewColumn, ViewEntity } from "typeorm"; + +@ViewEntity({ + expression: `SELECT + \`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`Id\`, + \`bma_ehr_organization_demo\`.\`profile\`.\`prefix\` AS \`prefix\`, + \`bma_ehr_organization_demo\`.\`profile\`.\`firstName\` AS \`firstName\`, + \`bma_ehr_organization_demo\`.\`profile\`.\`lastName\` AS \`lastName\`, + \`bma_ehr_organization_demo\`.\`profile\`.\`citizenId\` AS \`citizenId\`, + \`bma_ehr_organization_demo\`.\`profile\`.\`position\` AS \`position\`, + \`bma_ehr_organization_demo\`.\`posMaster\`.\`isDirector\` AS \`isDirector\`, + \`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`, + \`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`, + \`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`, + NULL AS \`actFullName\` + FROM + (((\`bma_ehr_organization_demo\`.\`posMaster\` + JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`))) + JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`))) + JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))`, +}) +export class viewDirector { + @ViewColumn() + id: string; + @ViewColumn() + prefix: string; + @ViewColumn() + firstName: string; + @ViewColumn() + lastName: string; + @ViewColumn() + citizenId: string; + @ViewColumn() + position: string; + @ViewColumn() + posLevel: string; + @ViewColumn() + posType: string; + @ViewColumn() + isDirector: boolean; + @ViewColumn() + orgRootId: string; + @ViewColumn() + actFullName: string; +} diff --git a/src/entities/view/viewDirectorActing.ts b/src/entities/view/viewDirectorActing.ts new file mode 100644 index 00000000..e7d9333b --- /dev/null +++ b/src/entities/view/viewDirectorActing.ts @@ -0,0 +1,51 @@ +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\`, + \`posMasterChild\`.\`isDirector\` AS \`isDirector\`, + \`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`, + \`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`, + \`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`, + 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\`))) + 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\`))) + JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))`, +}) +export class viewCommanderDirector { + @ViewColumn() + id: string; + @ViewColumn() + prefix: string; + @ViewColumn() + firstName: string; + @ViewColumn() + lastName: string; + @ViewColumn() + citizenId: string; + @ViewColumn() + position: string; + @ViewColumn() + posLevel: string; + @ViewColumn() + posType: string; + @ViewColumn() + isDirector: boolean; + @ViewColumn() + orgRootId: string; + @ViewColumn() + actFullName: string; +}