SELECT s.station_name AS "气象站名称", s.city AS "所在城市", o.observation_time AS "观测时间", o.temperature AS "温度(℃)", o.humidity AS "湿度(%)", o.precipitation AS "降水量(mm)" FROM fact_weather_observation o JOIN dim_weather_station s ON o.station_id = s.station_id ORDERBY o.observation_time DESC
SELECT f.forecast_id AS "预报ID", s.city AS "城市", f.forecast_time AS "预报时间", f.weather AS "天气", f.temp_high AS "最高温度", f.temp_low AS "最低温度" FROM fact_weather_forecast f JOIN dim_weather_station s ON f.station_id = s.station_id ORDERBY f.forecast_time ASC
气象灾害预警(右下角滚动屏) 数据库查询语句
1 2 3 4 5 6 7 8
SELECT a.alert_id AS "预警ID", s.city AS "城市", a.alert_type AS "预警类型", a.issue_time AS "发布时间" FROM dim_weather_alert a JOIN dim_weather_station s ON a.station_id = s.station_id ORDERBY a.issue_time DESC
地图
设置图表切换属性为按钮,实现点击切换展示降雨量、湿度、温度、气象站点
地图根据值设置渐变效果
其中降雨量、湿度、温度使用实时天气数据的查询语句结果,气象站点使用以下查询数据库语句:
1 2 3 4 5 6 7 8
SELECT station_id AS "站点ID", station_name AS "气象站名称", city AS "所属城市", longitude AS "经度坐标", latitude AS "纬度坐标", longitude ||','|| latitude AS "经纬度坐标" FROM dim_weather_station
-- 历史数据表单中的数据集 SELECT* FROM fact_historical_summary h JOIN dim_weather_station s ON h.station_id = s.station_id WHERE1=1 ${if(city == "",""," AND s.city IN ('"+city+"')")} ${if(date== "",""," AND h.summary_date = TO_DATE('"+date+"','YYYY-MM-DD')")}
-- 天气预报表单中的数据集 SELECT* FROM fact_weather_forecast f JOIN dim_weather_station s ON f.station_id = s.station_id WHERE1=1 ${if(city == "",""," AND s.city IN ('"+city+"')")} ${if(date== "",""," AND TRUNC(f.forecast_time) = TO_DATE('"+date+"','YYYY-MM-DD')")}
-- 灾害预警表单中的数据集 SELECT* FROM dim_weather_alert a JOIN dim_weather_station s ON a.station_id = s.station_id WHERE1=1 ${if(city == "",""," AND s.city IN ('"+city+"')")} ${if(date== "",""," AND TRUNC(a.issue_time) = TO_DATE('"+date+"','YYYY-MM-DD')")}
-- 气象站点表单中的数据集 SELECT* FROM dim_weather_station WHERE1=1 ${if(city == "",""," AND city IN ('"+city+"')")}
${if(city == “”,””,” AND city IN (‘“+city+”‘)”)} 为确保以上语句生效需要设置城市下拉复选框的返回值分隔符为',' 否则可能需要改为${if(city == “”,””,” AND s.city IN (‘“+city.replace(“,”,”‘,’”)+”‘)”)}