From f99abcd94998485854ca18f149fecc33c24bf5de Mon Sep 17 00:00:00 2001
From: lizijie <lzjiiie@163.com>
Date: Fri, 20 Nov 2020 14:10:25 +0800
Subject: [PATCH] 校准值插入redis
---
src/main/resources/mapper/AQIMapper.xml | 31 ++++++++++++++++++++++++++++---
1 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/src/main/resources/mapper/AQIMapper.xml b/src/main/resources/mapper/AQIMapper.xml
index 3771b2c..cb01946 100644
--- a/src/main/resources/mapper/AQIMapper.xml
+++ b/src/main/resources/mapper/AQIMapper.xml
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.moral.mapper.AQIMapper">
+ <cache/>
+
<select id="getCityAqiConfig" resultType="java.util.LinkedHashMap">
select * from city_aqi_config;
</select>
@@ -18,8 +20,31 @@
ifnull(aqi_json->'$.O3C',aqi_json->'$.O3') 'O3'
from hangzhou_aqi
where city_code=#{cityCode}
- and time >= #{startTime}
- AND time <![CDATA[<]]> #{endTime}
- and DATE_FORMAT(time, #{typeFormat}) like '%${time}'
+ and DATE_FORMAT(time, #{typeFormat}) in
+ <foreach collection="times" open="(" separator="," close=")" item="time">
+ #{time}
+ </foreach>
+ </select>
+
+ <select id="getO3ByTime" resultType="java.lang.String" useCache="true">
+ select ifnull(aqi_json->'$.O3C',aqi_json->'$.O3') as 'O3'
+ from hangzhou_aqi
+ where city_code=#{cityCode}
+ and DATE_FORMAT(time, #{typeFormat})=#{time}
+ </select>
+
+ <select id="getAqiByHour" resultType="java.util.Map">
+ select DATE_FORMAT(time, '%Y-%m-%d %H:%i:%s') time,
+ value
+ from history_aqi_${timeUnits}
+ where city_code=#{cityCode}
+ and DATE_FORMAT(time, '%Y%H')=#{yearAndHour}
+ </select>
+
+ <select id="getO3FromHistory" resultType="java.lang.String" useCache="true">
+ select value ->'$.O3C' as 'O3'
+ from history_aqi_${timeUnits}
+ where city_code=#{cityCode}
+ and DATE_FORMAT(time, #{typeFormat})=#{time}
</select>
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0