|
|
@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
<result property="deviceName" column="device_name" /> |
|
|
|
<result property="stakeMark" column="stake_mark" /> |
|
|
|
<result property="direction" column="direction" /> |
|
|
|
<result property="deviceState" column="device_state" /> |
|
|
|
</resultMap> |
|
|
|
<resultMap type="map" id="countMap"> |
|
|
|
<result property="timeSlot" column="time_slot" /> |
|
|
@ -172,16 +173,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="selectlistAll" parameterType="com.zc.business.domain.DcMeteorologicalDetectorData" resultMap="DcMeteorologicalDetectorDataResult"> |
|
|
|
SELECT mdd1.id,mdd1.iot_device_id,mdd1.rainfall,mdd1.visibility_type,mdd1. visibility,mdd1.atmospheric_pressure, |
|
|
|
mdd1. temperature,mdd1. humidity,mdd1.wind_direction, mdd1. wind_speed, mdd1. precipitation_type, mdd1.wet_slippery_coefficient, |
|
|
|
mdd1.remote_road_surface_temperature, mdd1. remote_road_surface_status, mdd1. water_film_ice_snow_value,mdd1.create_time, |
|
|
|
mdd1.stake_mark,mdd1.device_name,mdd1.direction |
|
|
|
FROM dc_meteorological_detector_data mdd1 |
|
|
|
JOIN ( |
|
|
|
SELECT device_name, MAX(create_time) AS max_create_time |
|
|
|
FROM dc_meteorological_detector_data |
|
|
|
GROUP BY device_name |
|
|
|
) mdd2 |
|
|
|
ON mdd1.device_name = mdd2.device_name AND mdd1.create_time = mdd2.max_create_time; |
|
|
|
WITH LatestData AS ( |
|
|
|
SELECT |
|
|
|
m.* |
|
|
|
FROM |
|
|
|
dc_meteorological_detector_data m |
|
|
|
WHERE |
|
|
|
m.create_time = ( |
|
|
|
SELECT MAX(m2.create_time) |
|
|
|
FROM dc_meteorological_detector_data m2 |
|
|
|
WHERE m.iot_device_id = m2.iot_device_id |
|
|
|
) |
|
|
|
) |
|
|
|
SELECT |
|
|
|
d.iot_device_id, d.stake_mark, d.direction, d.device_name, d.device_state, |
|
|
|
ld.create_time AS latest_create_time, |
|
|
|
ld.rainfall, ld.visibility_type, ld.visibility, ld.atmospheric_pressure, |
|
|
|
ld.temperature, ld.humidity, ld.wind_direction, ld.wind_speed, |
|
|
|
ld.precipitation_type, ld.wet_slippery_coefficient, |
|
|
|
ld.remote_road_surface_temperature, ld.remote_road_surface_status, |
|
|
|
ld.water_film_ice_snow_value |
|
|
|
FROM |
|
|
|
dc_device d |
|
|
|
LEFT JOIN |
|
|
|
LatestData ld ON |
|
|
|
d.iot_device_id = ld.iot_device_id |
|
|
|
WHERE |
|
|
|
d.device_type = 3; |
|
|
|
|
|
|
|
</select> |
|
|
|
</mapper> |