fix:修改了聚合查询

This commit is contained in:
fengyarnom 2025-05-15 17:29:57 +08:00
parent 785a02bf8a
commit 2be5f5212a

View File

@ -64,7 +64,7 @@ func (dao *SensorDAO) GetAggregatedData(start, end time.Time, interval string) (
// 构建通用查询
query := `
SELECT
MIN(timestamp) as ts,
DATE_FORMAT(MIN(timestamp), '%Y-%m-%dT%H:%i:%S') as ts,
ROUND(AVG(temperature)/10, 1) as avg_temp,
MAX(rainfall) - MIN(rainfall) as rainfall,
ROUND(AVG(humidity)/10, 1) as avg_humidity,