<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.moral.api.mapper.HistoryFiveMinutelyMapper">
|
|
<!--获取5分钟风场数据-->
|
<select id="getAreaWindData" resultType="com.moral.api.pojo.dto.Wind.WindData">
|
SELECT
|
d.longitude AS longitude,
|
d.latitude AS latitude,d.mac,
|
CASE WHEN
|
h.value->'$.a01007' = 0 THEN 0.1 ELSE h.value->'$.a01007' END AS windSpeed,
|
h.value->'$.a01008' AS windDir
|
FROM history_five_minutely_${timeUnits} h ,
|
`device` AS d
|
WHERE d.is_delete = '0'
|
AND d.mac = h.mac
|
AND d.monitor_point_id IN
|
<foreach item="monitorPointId" collection="monitorPointIds" index="index" open="(" separator="," close=")">
|
#{monitorPointId}
|
</foreach>
|
AND h.time = (SELECT max(time) FROM history_five_minutely_${timeUnits})
|
</select>
|
|
<select id="listResult" resultType="com.moral.api.entity.HistoryFiveMinutely">
|
SELECT mac,time,value FROM history_five_minutely${table}
|
WHERE (mac = #{mac} AND time BETWEEN #{startDate} AND #{endDate})
|
order by time desc
|
</select>
|
<select id="listResultOne" resultType="com.moral.api.entity.HistoryFiveMinutely">
|
SELECT mac,time,value FROM history_five_minutely${table}
|
WHERE (mac = #{mac})
|
order by time desc
|
limit 1
|
</select>
|
</mapper>
|