ZhuDongming
2020-04-13 14753bc669a106315717f0f4a70bf2bf5c3e8995
src/main/resources/mapper/HistoryMapper.xml
@@ -216,4 +216,24 @@
      AND h.time BETWEEN #{starttime} AND #{endtime}
    </select>
    <!-- 走航车sensor查询 -->
    <select id="getCarSensorData" resultType="java.util.LinkedHashMap">
        SELECT
        DATE_FORMAT(h.time,'%Y-%m-%d %H:%i:%s') time,
        <foreach collection="sensorKeys" item="sensorKey" separator=",">
            h.value->'$.${sensorKey}' as '${sensorKey}'
        </foreach>
        FROM
        history as h
        <where>
            <if test="mac!=null">
                and h.mac=#{mac}
            </if>
            and h.time >= #{startTime}
            and h.time <![CDATA[<]]> #{endTime}
        </where>
        ORDER BY
        h.time
    </select>
</mapper>