|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int insertRealWeather(List<Map<String, Object>> list); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | void deleteRealWeather(String time); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<Map<String, Object>> getTempAndCloud(Map<String, Object> params); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> getDayData(Map<String, Object> params); | 
|---|
|  |  |  | 
|---|
|  |  |  | Map<String, Object> getTimeMaxTemp(Map<String, Object> params); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> getTimeMinTemp(Map<String, Object> params); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<Map<String, Object>> getWeatherByHour(Map<String, Object> params); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | hashSet.add(hashMap); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> smap = new HashMap<>(); | 
|---|
|  |  |  | smap.put("name1", "苏州市"); | 
|---|
|  |  |  | smap.put("parentName", "江苏省"); | 
|---|
|  |  |  | smap.put("cityCode", 320500); | 
|---|
|  |  |  | smap.put("parentCode", 320000); | 
|---|
|  |  |  | hashSet.add(smap); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> bmap = new HashMap<>(); | 
|---|
|  |  |  | bmap.put("name1", "北京市"); | 
|---|
|  |  |  | bmap.put("parentName", "北京市"); | 
|---|
|  |  |  | bmap.put("cityCode", 110000); | 
|---|
|  |  |  | bmap.put("parentCode", 110000); | 
|---|
|  |  |  | hashSet.add(bmap); | 
|---|
|  |  |  | Map<String,Object> kunShanMap=new HashMap<>(); | 
|---|
|  |  |  | kunShanMap.put("name1","苏州市"); | 
|---|
|  |  |  | kunShanMap.put("parentName","江苏省"); | 
|---|
|  |  |  | 
|---|
|  |  |  | resultMap.put("json",JSONObject.toJSONString(jsonMap)); | 
|---|
|  |  |  | resultList.add(resultMap); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | realWeatherMapper.deleteRealWeather(sdf1.format(now)); | 
|---|
|  |  |  | return realWeatherMapper.insertRealWeather(resultList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | </foreach> | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <delete id="deleteRealWeather"> | 
|---|
|  |  |  | delete from real_weather where time=#{time} | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="getTempAndCloud" resultType="java.util.Map"> | 
|---|
|  |  |  | select DATE_FORMAT(time, #{typeFormat}) time, | 
|---|
|  |  |  | json->'$.temp' 'temp', | 
|---|
|  |  |  | 
|---|
|  |  |  | and city_code=130900 | 
|---|
|  |  |  | ) limit 0,1; | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="getWeatherByHour" resultType="java.util.Map"> | 
|---|
|  |  |  | 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> | 
|---|
|  |  |  | </mapper> | 
|---|