Browse Source

气象检设备map

develop
王兴琳 8 months ago
parent
commit
82fc1b0f9d
  1. 48
      zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml

48
zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml

@ -173,31 +173,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectlistAll" parameterType="com.zc.business.domain.DcMeteorologicalDetectorData" resultMap="DcMeteorologicalDetectorDataResult">
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
d.iot_device_id,
d.stake_mark,
d.direction,
d.device_name,
d.device_state,
lm.create_time AS latest_create_time,
lm.rainfall,
lm.visibility_type,
lm.visibility,
lm.atmospheric_pressure,
lm.temperature,
lm.humidity,
lm.wind_direction,
lm.wind_speed,
lm.precipitation_type,
lm.wet_slippery_coefficient,
lm.remote_road_surface_temperature,
lm.remote_road_surface_status,
lm.water_film_ice_snow_value
FROM
dc_device d
LEFT JOIN
LatestData ld ON
d.iot_device_id = ld.iot_device_id
dc_meteorological_detector_data lm
ON
d.iot_device_id = lm.iot_device_id
AND lm.id IN (
SELECT MAX(id)
FROM dc_meteorological_detector_data
WHERE iot_device_id = d.iot_device_id
)
WHERE
d.device_type = 3;

Loading…
Cancel
Save