| | |
| | | h.mac
|
| | | </select>
|
| | |
|
| | | <select id="getSensorDataByMacOnce" resultType="java.util.LinkedHashMap">
|
| | | SELECT
|
| | | h.mac,DATE_FORMAT(time,'%Y-%m-%dT%H:%i') time,
|
| | | <foreach collection="sensorKeys" separator="," item="sensorKey">
|
| | | AVG(value->'$.${sensorKey}') AS '${sensorKey}',
|
| | | MAX(cast(h.value ->'$.${sensorKey}' as decimal(11,3))) AS 'MAX${sensorKey}',
|
| | | MIN(cast(h.value ->'$.${sensorKey}' as decimal(11,3))) AS 'MIN${sensorKey}'
|
| | | </foreach>
|
| | | FROM
|
| | | history h
|
| | | WHERE
|
| | | h.time >= #{start}
|
| | | AND h.time <![CDATA[<]]> #{end}
|
| | | and h.mac in
|
| | | <foreach collection="macList" index="index" item="mac" open="(" separator="," close=")">
|
| | | #{mac}
|
| | | </foreach>
|
| | | group by
|
| | | h.mac,DATE_FORMAT(time,'%Y-%m-%dT%H:%i')
|
| | | </select>
|
| | |
|
| | | <select id="getSensorDataOnce" resultType="java.util.LinkedHashMap">
|
| | | SELECT
|
| | | h.mac,DATE_FORMAT(time,'%Y-%m-%dT%H:%i') time,
|