hrms-api-development/src/entities/view/viewDevScholarship.ts

27 lines
668 B
TypeScript
Raw Normal View History

2025-02-13 17:34:19 +07:00
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\`
`,
})
2025-02-13 18:01:34 +07:00
export class viewDevScholarship {
2025-02-13 17:34:19 +07:00
@ViewColumn()
rootId: string;
@ViewColumn()
root: string;
@ViewColumn()
numberOfRecords: number;
@ViewColumn()
numberOfScholarshipTypes: number;
@ViewColumn()
totalBudgetApprove: number;
}