select city_code AS cityCode,
city_id AS cityId
from city_weather_config
insert into
forecast_weather
values
(#{item.cityCode},#{item.time},#{item.json})
delete from forecast_weather
where
time >= #{start}
AND time #{end}
and city_code=#{cityCode}
select json->'$.beam' as 'beam'
from forecast_weather
where time=#{time}
and city_code=#{cityCode}
insert into
real_weather
values
(#{item.cityCode},#{item.time},#{item.json})
delete from real_weather where time=#{time}
select DATE_FORMAT(time, #{typeFormat}) time,
json->'$.temp' 'temp',
json->'$.cloud' 'cloud'
from real_weather
where city_code=#{cityCode}
and time >= #{startTime}
AND time #{endTime}
and DATE_FORMAT(time,'%H:%i:%s')=#{time}
and cast(json->'$.condition' as UNSIGNED INTEGER)>=#{condition}
select
round(avg(json->'$.temp')) 'tempAvg',
round(avg(json->'$.vis')) 'vis',
round(avg(json->'$.cloud')) 'cloud',
round(avg(json->'$.windSpeed')) 'windSpeed',
round(sum(json->'$.precip'),1) 'precip'
from real_weather
where city_code=#{cityCode}
and time >= #{start}
AND time #{end}
select
DATE_FORMAT(time, #{typeFormat}) time,
from real_weather
where city_code=#{cityCode}
and time >= #{start}
AND time #{end}
and json->'$.temp'=
(
SELECT REPLACE(max(json->'$.temp'),"\"","")
FROM real_weather
WHERE time>=#{start}
and time #{end}
and city_code=130900
) limit 0,1;
select
DATE_FORMAT(time, #{typeFormat}) time,
from real_weather
where city_code=#{cityCode}
and time >= #{start}
AND time #{end}
and json->'$.temp'=
(
SELECT REPLACE(max(json->'$.temp'),"\"","")
FROM real_weather
WHERE time>=#{start}
and time #{end}
and city_code=130900
) limit 0,1;
select DATE_FORMAT(time, '%Y-%m-%d %H:%i:%s') time,
value
from history_weather_${timeUnits}
where city_code=#{cityCode}
and (
DATE_FORMAT(time, '%Y%H')=#{yearAndHour}
or DATE_FORMAT(time, '%Y%H')=#{yearAndHour1}
)
select DATE_FORMAT(time, #{typeFormat}) as time
from history_weather_${timeUnits}
city_code=#{cityCode}
and cast(value->'$.condition' as UNSIGNED integer) > #{score}
and cast(value->'$.condition' as UNSIGNED integer) #{score}
and cast(value->'$.temp' as decimal(10, 1)) >= #{startTemp}
and cast(value->'$.temp' as decimal(10, 1)) #{endTemp}
and cast(value->'$.pressure' as UNSIGNED integer) >= #{startPressure}
and cast(value->'$.pressure' as UNSIGNED integer) #{endPressure}
and time >= #{start}
and time #{end}
and DATE_FORMAT(time, '%H') in
#{hour}
select DATE_FORMAT(time, #{typeFormat}) as time
from real_weather
city_code=#{cityCode}
and json->'$.windDir' = #{windDir}
and cast(json->'$.condition' as UNSIGNED integer) > #{score}
and cast(json->'$.condition' as UNSIGNED integer) #{score}
and cast(json->'$.temp' as decimal(10, 1)) >= #{startTemp}
and cast(json->'$.temp' as decimal(10, 1)) #{endTemp}
and cast(json->'$.pressure' as UNSIGNED integer) >= #{startPressure}
and cast(json->'$.pressure' as UNSIGNED integer) #{endPressure}
and time >= #{start}
and time #{end}
and DATE_FORMAT(time, '%H') in
#{hour}
and DATE_FORMAT(time, '%m')=#{month}