jinpengyong
2021-11-23 4108fd24ac888934a23e9b9129c4392baa2ffb94
src/main/resources/mapper/HistoryHourlyMapper.xml
@@ -29,9 +29,9 @@
                    MAX(json->'$.${sensorKey}[2]') AS 'MAX${sensorKey}'
                </when>
                <otherwise>
                    AVG(json->'$.${sensorKey}[0]') AS 'AVG${sensorKey}',
                    AVG(json->'$.${sensorKey}[0]') AS '${sensorKey}',
                    MIN(json->'$.${sensorKey}[1]') AS 'MIN${sensorKey}',
                    MAX(json->'$.${sensorKey}[2]') AS '${sensorKey}'
                    MAX(json->'$.${sensorKey}[2]') AS 'MAX${sensorKey}'
                </otherwise>
            </choose>
        </foreach>
@@ -96,4 +96,10 @@
        group by h.time
    </select>
    <select id="selectCountByMac" resultType="java.lang.Integer">
        SELECT count(1) FROM history_hourly
        WHERE mac = #{mac}
        AND `time` >= #{start}
        AND `time` <![CDATA[<]]> #{end}
    </select>
</mapper>