hrms-api-development/src/entities/view/viewDevScholarship.ts
2025-02-13 18:43:36 +07:00

28 lines
711 B
TypeScript

import { ViewColumn, ViewEntity } from "typeorm";
@ViewEntity({
expression: `SELECT MAX(\`rootId\`) AS rootId,
MAX(\`root\`) AS root,\`degreeLevel\`,
COUNT(*) AS numberOfRecords,
COUNT(DISTINCT \`scholarshipType\`) AS numberOfScholarshipTypes,
SUM(\`budgetApprove\`) AS totalBudgetApprove
FROM \`developmentScholarship\`
GROUP BY \`rootId\`,\`degreeLevel\`
`,
})
export class viewDevScholarship {
@ViewColumn()
rootId: string;
@ViewColumn()
root: string;
@ViewColumn()
degreeLevel: string;
@ViewColumn()
numberOfRecords: number;
@ViewColumn()
numberOfScholarshipTypes: number;
@ViewColumn()
totalBudgetApprove: number;
}