| | |
| | | group by |
| | | h.mac |
| | | </select> |
| | | |
| | | <select id="getHourlySensorDataToCalculateO3" resultType="java.util.LinkedHashMap"> |
| | | SELECT |
| | | h.mac, |
| | | <foreach collection="sensorKeys" separator="," item="sensorKey"> |
| | | AVG(json->'$.${sensorKey}[0]') AS '${sensorKey}', |
| | | MIN(json->'$.${sensorKey}[1]') AS 'MIN${sensorKey}', |
| | | MAX(json->'$.${sensorKey}[2]') AS 'MAX${sensorKey}' |
| | | </foreach> |
| | | FROM |
| | | history_hourly h |
| | | WHERE |
| | | h.time = #{time} |
| | | AND h.mac in |
| | | <foreach collection="macList" open="(" separator="," close=")" |
| | | item="mac"> |
| | | #{mac} |
| | | </foreach> |
| | | group by |
| | | h.mac |
| | | </select> |
| | | |
| | | <insert id="insertHistoryO3Hourly"> |
| | | insert into |
| | | history_hourly_o3 |
| | | values |
| | | <foreach collection="list" item="map" separator=","> |
| | | (#{map.mac},#{map.time},#{map.json}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | </mapper> |