jinpengyong
2020-12-23 8fb013a6d6707929799e9f7a8a82f311cbca29ae
src/main/resources/mapper/HistoryFiveMinutelyMapper.xml
@@ -32,4 +32,19 @@
            #{mac}
        </foreach>
    </select>
    <select id="getFiveMinutesDataByMacsAndTimeSolt" resultType="map">
        select h.mac,h.time,
        <foreach collection="sensorKeys" separator="," item="sensorKey">
            json->'$.${sensorKey}' AS '${sensorKey}'
        </foreach>
        FROM history_five_minutely_${yearAndMonth} h
        WHERE mac IN
        <foreach collection="macs" separator="," open="(" close=")" item="mac">
            #{mac}
        </foreach>
        AND time BETWEEN #{startTime} AND #{endTime}
        ORDER BY h.time DESC
        LIMIT #{macNumber}
    </select>
</mapper>