add viewProfileEmp
This commit is contained in:
parent
db3c9583f6
commit
ee71e985ab
3 changed files with 65 additions and 8 deletions
55
src/entities/view/viewProfileEmployeeEvaluation.ts
Normal file
55
src/entities/view/viewProfileEmployeeEvaluation.ts
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
import { ViewColumn, ViewEntity } from "typeorm";
|
||||
|
||||
@ViewEntity({
|
||||
expression: `SELECT
|
||||
\`profileEmployeeId\`,
|
||||
\`period\`,
|
||||
\`year\`,
|
||||
\`employeePosMaster\`.\`orgRootId\`,
|
||||
\`employeePosMaster\`.\`orgChild1Id\`,
|
||||
\`employeePosMaster\`.\`orgChild2Id\`,
|
||||
\`employeePosMaster\`.\`orgChild3Id\`,
|
||||
\`employeePosMaster\`.\`orgChild4Id\`,
|
||||
COUNT(*) AS recordCount,
|
||||
SUM(pointSum) AS totalPointSum,
|
||||
SUM(pointSum) / COUNT(*) AS result
|
||||
FROM \`profileAssessment\`
|
||||
LEFT JOIN \`profileEmployee\` ON \`profileAssessment\`.\`profileEmployeeId\` = \`profileEmployee\`.\`id\`
|
||||
LEFT JOIN \`employeePosMaster\` ON \`profileEmployee\`.\`id\` = \`employeePosMaster\`.\`current_holderId\`
|
||||
LEFT JOIN \`orgRevision\` ON \`employeePosMaster\`.\`orgRevisionId\` = \`orgRevision\`.\`id\`
|
||||
WHERE \`period\` IS NOT NULL
|
||||
AND \`orgRevision\`.\`orgRevisionIsCurrent\` = TRUE
|
||||
GROUP BY \`profileEmployeeId\`, \`period\`, \`year\`,
|
||||
\`employeePosMaster\`.\`orgRootId\`,
|
||||
\`employeePosMaster\`.\`orgChild1Id\`,
|
||||
\`employeePosMaster\`.\`orgChild2Id\`,
|
||||
\`employeePosMaster\`.\`orgChild3Id\`,
|
||||
\`employeePosMaster\`.\`orgChild4Id\`
|
||||
ORDER BY \`year\` DESC, \`period\` ASC;
|
||||
`,
|
||||
})
|
||||
|
||||
export class viewProfileEmployeeEvaluation {
|
||||
@ViewColumn()
|
||||
profileEmployeeId: string;
|
||||
@ViewColumn()
|
||||
period: string;
|
||||
@ViewColumn()
|
||||
year: number;
|
||||
@ViewColumn()
|
||||
orgRootId: string;
|
||||
@ViewColumn()
|
||||
orgChild1Id: string;
|
||||
@ViewColumn()
|
||||
orgChild2Id: string;
|
||||
@ViewColumn()
|
||||
orgChild3Id: string;
|
||||
@ViewColumn()
|
||||
orgChild4Id: string;
|
||||
@ViewColumn()
|
||||
recordCount: number;
|
||||
@ViewColumn()
|
||||
totalPointSum: number;
|
||||
@ViewColumn()
|
||||
result: number;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue