| | |
| | | <mapper namespace="com.moral.mapper.HistoryMapper"> |
| | | <select id="getAreaAllDataByAccount" resultType="java.util.LinkedHashMap">
|
| | | SELECT
|
| | | <if test="macKey == 'all'">
|
| | | ${queryColumns}
|
| | | </if> |
| | | <if test="macKey != 'all'">
|
| | | d.`name`,
|
| | | AVG( h.`value` -> ${macKey}) avg
|
| | | </if> |
| | | <if test="macKey != null">
|
| | | d.`name`,
|
| | | </if> |
| | | <foreach collection="sensorKeys" separator="," item="sensorKey">
|
| | | AVG(h.`value` ->'$.${sensorKey}[0]') AS '${sensorKey}'
|
| | | </foreach>
|
| | | FROM
|
| | | history h,
|
| | | device d,
|
| | |
| | | #{listItem}
|
| | | </foreach>
|
| | | </if>
|
| | | <if test="deviceVersionId != null">
|
| | | AND d.device_version_id = #{deviceVersionId} |
| | | </if>
|
| | | <if test="macKey != 'all'">
|
| | | <if test="macKey != null">
|
| | | GROUP BY d.id
|
| | | ORDER BY avg desc
|
| | | ORDER BY ${macKey} desc
|
| | | </if>
|
| | | </select>
|
| | | |
| | |
|
| | | |
| | | </mapper> |