2024-11-04 12:03:09 +07:00
|
|
|
import { ViewColumn, ViewEntity } from "typeorm";
|
|
|
|
|
|
|
|
|
|
@ViewEntity({
|
|
|
|
|
expression: `SELECT
|
2024-11-08 14:05:31 +07:00
|
|
|
\`profile\`.\`id\` AS \`Id\`,
|
|
|
|
|
\`profile\`.\`prefix\` AS \`prefix\`,
|
|
|
|
|
\`profile\`.\`firstName\` AS \`firstName\`,
|
|
|
|
|
\`profile\`.\`lastName\` AS \`lastName\`,
|
|
|
|
|
\`profile\`.\`citizenId\` AS \`citizenId\`,
|
|
|
|
|
\`profile\`.\`position\` AS \`position\`,
|
2024-11-05 13:34:40 +07:00
|
|
|
CONCAT((CASE
|
2024-11-08 14:05:31 +07:00
|
|
|
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\`
|
2024-11-05 13:34:40 +07:00
|
|
|
END),
|
2024-11-08 14:05:31 +07:00
|
|
|
\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
|
|
|
|
|
\`posMaster\`.\`isDirector\` AS \`isDirector\`,
|
|
|
|
|
\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
|
|
|
|
|
\`posType\`.\`posTypeName\` AS \`posType\`,
|
|
|
|
|
\`posExecutive\`.\`posExecutiveName\` AS \`posExecutiveName\`,
|
|
|
|
|
\`orgRoot\`.\`isDeputy\` AS \`isDeputy\`,
|
|
|
|
|
\`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\`,
|
2025-01-09 17:00:27 +07:00
|
|
|
\`profile\`.\`id\` AS \`actFullNameId\`,
|
|
|
|
|
CONCAT(\`profile\`.\`prefix\`,
|
|
|
|
|
\`profile\`.\`firstName\`,
|
|
|
|
|
' ',
|
|
|
|
|
\`profile\`.\`lastName\`) AS \`actFullName\`
|
2025-01-09 14:13:27 +07:00
|
|
|
|
2024-11-04 12:03:09 +07:00
|
|
|
FROM
|
2024-11-08 14:05:31 +07:00
|
|
|
((((((((((\`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)`,
|
2024-11-04 12:03:09 +07:00
|
|
|
})
|
|
|
|
|
export class viewDirector {
|
|
|
|
|
@ViewColumn()
|
|
|
|
|
id: string;
|
|
|
|
|
@ViewColumn()
|
|
|
|
|
prefix: string;
|
|
|
|
|
@ViewColumn()
|
|
|
|
|
firstName: string;
|
|
|
|
|
@ViewColumn()
|
|
|
|
|
lastName: string;
|
|
|
|
|
@ViewColumn()
|
|
|
|
|
citizenId: string;
|
|
|
|
|
@ViewColumn()
|
|
|
|
|
position: string;
|
|
|
|
|
@ViewColumn()
|
2024-11-05 10:46:26 +07:00
|
|
|
posNo: string;
|
|
|
|
|
@ViewColumn()
|
2024-11-04 12:03:09 +07:00
|
|
|
posLevel: string;
|
|
|
|
|
@ViewColumn()
|
|
|
|
|
posType: string;
|
|
|
|
|
@ViewColumn()
|
2024-11-08 10:19:11 +07:00
|
|
|
posExecutiveName: string;
|
|
|
|
|
@ViewColumn()
|
2024-11-04 12:03:09 +07:00
|
|
|
isDirector: boolean;
|
|
|
|
|
@ViewColumn()
|
2024-11-08 10:19:11 +07:00
|
|
|
isDeputy: boolean;
|
|
|
|
|
@ViewColumn()
|
2024-11-04 12:03:09 +07:00
|
|
|
orgRootId: string;
|
|
|
|
|
@ViewColumn()
|
2024-11-08 10:19:11 +07:00
|
|
|
orgChild1Id: string;
|
|
|
|
|
@ViewColumn()
|
|
|
|
|
orgChild2Id: string;
|
|
|
|
|
@ViewColumn()
|
|
|
|
|
orgChild3Id: string;
|
|
|
|
|
@ViewColumn()
|
|
|
|
|
orgChild4Id: string;
|
|
|
|
|
@ViewColumn()
|
2024-11-05 10:46:26 +07:00
|
|
|
actFullNameId: string;
|
|
|
|
|
@ViewColumn()
|
2024-11-04 12:03:09 +07:00
|
|
|
actFullName: string;
|
2024-11-06 16:56:35 +07:00
|
|
|
@ViewColumn()
|
|
|
|
|
key: string;
|
2024-11-04 12:03:09 +07:00
|
|
|
}
|