lizijie
2020-12-03 a66d53c3cbfb0024804045f4d795be06089d4f9d
src/main/resources/mapper/HistoryFiveMinutelyMapper.xml
@@ -9,4 +9,27 @@
            #{mac}
        </foreach>
    </select>
    <select id="getFiveMinutesDataByMac" resultType="java.util.LinkedHashMap">
        select
        <foreach collection="sensorKeys" separator="," item="sensorKey">
          json->'$.${sensorKey}' AS '${sensorKey}'
        </foreach>
        FROM
        history_five_minutely_${yearAndMonth} h
        where  h.time = #{time}
        and h.mac = #{mac}
    </select>
    <select id="getFiveMinutesSersorDataByMacsAndTime" 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 time = #{time} and mac IN
        <foreach collection="macs" separator="," open="(" close=")" item="mac">
            #{mac}
        </foreach>
    </select>
</mapper>