| | |
| | | ORDER BY
|
| | | time
|
| | | </select>
|
| | |
|
| | | <select id="getSensorDataTodayMin" resultType="java.util.LinkedHashMap">
|
| | | SELECT
|
| | | DATE_FORMAT(time,'%Y-%m-%d %H:%i') time,
|
| | | <foreach collection="sensorKeys" separator="," item="sensorKey">
|
| | | MIN(h.value ->'$.${sensorKey}') AS '${sensorKey}'
|
| | | </foreach>
|
| | | FROM
|
| | | history h
|
| | | <where>
|
| | | <if test="mac!=null">
|
| | | and h.mac=#{mac}
|
| | | </if>
|
| | | and h.time >= #{startTime}
|
| | | and h.time <![CDATA[<=]]> #{endTime}
|
| | | </where>
|
| | | GROUP BY
|
| | | DATE_FORMAT(time,'%Y-%m-%d %H:%i')
|
| | | ORDER BY
|
| | | time
|
| | | </select>
|
| | |
|
| | | <select id="getSensorDataTodayMax" resultType="java.util.LinkedHashMap">
|
| | | SELECT
|
| | | DATE_FORMAT(time,'%Y-%m-%d %H:%i') time,
|
| | | <foreach collection="sensorKeys" separator="," item="sensorKey">
|
| | | MAX(h.value ->'$.${sensorKey}') AS '${sensorKey}'
|
| | | </foreach>
|
| | | FROM
|
| | | history h
|
| | | <where>
|
| | | <if test="mac!=null">
|
| | | and h.mac=#{mac}
|
| | | </if>
|
| | | and h.time >= #{startTime}
|
| | | and h.time <![CDATA[<=]]> #{endTime}
|
| | | </where>
|
| | | GROUP BY
|
| | | DATE_FORMAT(time,'%Y-%m-%d %H:%i')
|
| | | ORDER BY
|
| | | time
|
| | | </select>
|
| | | </mapper> |