diff --git a/src/server/routes/energy/index.ts b/src/server/routes/energy/index.ts index 24979ba..bdedcef 100644 --- a/src/server/routes/energy/index.ts +++ b/src/server/routes/energy/index.ts @@ -85,7 +85,9 @@ app.get('/hydrogen/overview', async (c) => { // Top5 加氢站(本年) const [top5Rows] = await pool.query( `SELECT b.hydrogen_station_id AS id, - COALESCE(s.short_name, s.name, os.fixed_station_name, os.station_name, '未知站点') AS name, + COALESCE(s.short_name, s.name, os.fixed_station_name, os.station_name, + CASE WHEN b.hydrogen_station_id IS NULL THEN '未关联站点' + ELSE CONCAT('未知站点 #', b.hydrogen_station_id) END) AS name, SUM(b.hydrogen_quantity) AS kg, SUM(b.cost_expense) AS fee FROM tab_energy_hydrogen_bill b @@ -162,7 +164,9 @@ app.get('/hydrogen/daily', async (c) => { const [stationRows] = await pool.query( `SELECT DATE_FORMAT(${HYDROGEN_LOCAL}, '%Y-%m-%d') AS d, b.hydrogen_station_id AS stationId, - COALESCE(s.short_name, s.name, os.fixed_station_name, os.station_name, '未知站点') AS stationName, + COALESCE(s.short_name, s.name, os.fixed_station_name, os.station_name, + CASE WHEN b.hydrogen_station_id IS NULL THEN '未关联站点' + ELSE CONCAT('未知站点 #', b.hydrogen_station_id) END) AS stationName, SUM(b.hydrogen_quantity) AS kg, AVG(b.cost_price) AS pricePerKg FROM tab_energy_hydrogen_bill b