修正得獎資訊團體賽的名稱

This commit is contained in:
2025-09-27 17:43:01 +08:00
parent 88c3fde372
commit 4a3a0052f0
5 changed files with 134 additions and 48 deletions

View File

@@ -4597,7 +4597,11 @@ export class AwardService extends DatabaseServiceBase {
id: result[0].id,
competition_name: (result[0] as any).competition_name,
competition_type: (result[0] as any).competition_type,
competition_id: result[0].competition_id
competition_id: result[0].competition_id,
team_name_from_teams: (result[0] as any).team_name_from_teams,
team_name: (result[0] as any).team_name,
app_name: (result[0] as any).app_name,
team_id: (result[0] as any).team_id
});
}
@@ -4698,7 +4702,21 @@ export class AwardService extends DatabaseServiceBase {
// 根據年份獲取獎項
static async getAwardsByYear(year: number): Promise<Award[]> {
const sql = 'SELECT * FROM awards WHERE year = ? ORDER BY month DESC, rank ASC';
const sql = `
SELECT
a.*,
c.name as competition_name,
c.type as competition_type,
c.description as competition_description,
c.start_date as competition_start_date,
c.end_date as competition_end_date,
t.name as team_name_from_teams
FROM awards a
LEFT JOIN competitions c ON a.competition_id = c.id
LEFT JOIN teams t ON a.team_id = t.id
WHERE a.year = ?
ORDER BY a.month DESC, a.rank ASC
`;
return await db.query<Award>(sql, [year]);
}