This commit is contained in:
Warunee Tamkoo 2024-11-04 12:03:09 +07:00
parent af38addf46
commit c1d35afbbf
2 changed files with 96 additions and 0 deletions

View file

@ -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;
}

View file

@ -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;
}