Browse Source

气象设备

develop
王兴琳 8 months ago
parent
commit
6ecc33a763
  1. 2
      zc-business/src/main/java/com/zc/business/controller/DcEventController.java
  2. 189
      zc-business/src/main/java/com/zc/business/domain/DcMeteorologicalDetectorData.java
  3. 6
      zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java
  4. 20
      zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java
  5. 6
      zc-business/src/main/java/com/zc/business/service/IDcMeteorologicalDetectorDataService.java
  6. 14
      zc-business/src/main/java/com/zc/business/service/impl/DcMeteorologicalDetectorDataServiceImpl.java
  7. 112
      zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml

2
zc-business/src/main/java/com/zc/business/controller/DcEventController.java

@ -162,4 +162,6 @@ public class DcEventController extends BaseController
Map<String,Object> map = dcEventService.selectCount();
return map;
}
}

189
zc-business/src/main/java/com/zc/business/domain/DcMeteorologicalDetectorData.java

@ -1,5 +1,8 @@
package com.zc.business.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
@ -11,6 +14,9 @@ import com.ruoyi.common.core.domain.BaseEntity;
* @author ruoyi
* @date 2024-02-01
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DcMeteorologicalDetectorData extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -73,169 +79,26 @@ public class DcMeteorologicalDetectorData extends BaseEntity
/** 水膜厚度 */
@Excel(name = "水膜厚度")
private String waterFilmIceSnowValue;
@Excel(name = "设备名称")
private String deviceName;
@Excel(name = "桩号")
private String stakeMark;
@Excel(name = "方向")
private String direction;
// "rainfall": 0,
// "visibility": "05.000",
// "remoteRoadSurfaceTemperature": 11.5,
// "atmosphericPressure:": 1008.8,
// "precipitationType": 0,
// "wetSlipperyCoefficient": 80,
// "temperature": 12.6,
// "humidity": 63.4,
// "windDirection": 358,
// "windSpeed": 1.5,
// "remoteRoadSurfaceStatus": "01",
// "visibilityType": 4,
// "waterFilmIceSnowValue": 0
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setIotDeviceId(String iotDeviceId)
{
this.iotDeviceId = iotDeviceId;
}
public String getIotDeviceId()
{
return iotDeviceId;
}
public void setRainfall(String rainfall)
{
this.rainfall = rainfall;
}
public String getRainfall()
{
return rainfall;
}
public void setVisibilityType(String visibilityType)
{
this.visibilityType = visibilityType;
}
public String getVisibilityType()
{
return visibilityType;
}
public void setVisibility(String visibility)
{
this.visibility = visibility;
}
public String getVisibility()
{
return visibility;
}
public void setAtmosphericPressure(String atmosphericPressure)
{
this.atmosphericPressure = atmosphericPressure;
}
public String getAtmosphericPressure()
{
return atmosphericPressure;
}
public void setTemperature(String temperature)
{
this.temperature = temperature;
}
public String getTemperature()
{
return temperature;
}
public void setHumidity(String humidity)
{
this.humidity = humidity;
}
public String getHumidity()
{
return humidity;
}
public void setWindDirection(String windDirection)
{
this.windDirection = windDirection;
}
public String getWindDirection()
{
return windDirection;
}
public void setWindSpeed(String windSpeed)
{
this.windSpeed = windSpeed;
}
public String getWindSpeed()
{
return windSpeed;
}
public void setPrecipitationType(String precipitationType)
{
this.precipitationType = precipitationType;
}
public String getPrecipitationType()
{
return precipitationType;
}
public void setWetSlipperyCoefficient(String wetSlipperyCoefficient)
{
this.wetSlipperyCoefficient = wetSlipperyCoefficient;
}
public String getWetSlipperyCoefficient()
{
return wetSlipperyCoefficient;
}
public void setRemoteRoadSurfaceTemperature(String remoteRoadSurfaceTemperature)
{
this.remoteRoadSurfaceTemperature = remoteRoadSurfaceTemperature;
}
public String getRemoteRoadSurfaceTemperature()
{
return remoteRoadSurfaceTemperature;
}
public void setRemoteRoadSurfaceStatus(String remoteRoadSurfaceStatus)
{
this.remoteRoadSurfaceStatus = remoteRoadSurfaceStatus;
}
public String getRemoteRoadSurfaceStatus()
{
return remoteRoadSurfaceStatus;
}
public void setWaterFilmIceSnowValue(String waterFilmIceSnowValue)
{
this.waterFilmIceSnowValue = waterFilmIceSnowValue;
}
public String getWaterFilmIceSnowValue()
{
return waterFilmIceSnowValue;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("iotDeviceId", getIotDeviceId())
.append("rainfall", getRainfall())
.append("visibilityType", getVisibilityType())
.append("visibility", getVisibility())
.append("atmosphericPressure", getAtmosphericPressure())
.append("temperature", getTemperature())
.append("humidity", getHumidity())
.append("windDirection", getWindDirection())
.append("windSpeed", getWindSpeed())
.append("precipitationType", getPrecipitationType())
.append("wetSlipperyCoefficient", getWetSlipperyCoefficient())
.append("remoteRoadSurfaceTemperature", getRemoteRoadSurfaceTemperature())
.append("remoteRoadSurfaceStatus", getRemoteRoadSurfaceStatus())
.append("waterFilmIceSnowValue", getWaterFilmIceSnowValue())
.toString();
}
}

6
zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java

@ -1,6 +1,8 @@
package com.zc.business.mapper;
import java.util.List;
import java.util.Map;
import com.zc.business.domain.DcMeteorologicalDetectorData;
import com.zc.business.domain.MdDeviceData;
@ -59,4 +61,8 @@ public interface DcMeteorologicalDetectorDataMapper
* @return 结果
*/
int deleteDcMeteorologicalDetectorDataByIds(Long[] ids);
//统计
List<Map<String, String>> selectStatistics(String deviceName);
List<DcMeteorologicalDetectorData> selectlistAll(DcMeteorologicalDetectorData dcMeteorologicalDetectorData);
}

20
zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java

@ -445,7 +445,25 @@ public class DeviceMessageHandler {
*/
private void weatherDetectorMessageHandle(JSONObject msg) {
DcMeteorologicalDetectorData meteorologicalDetectorData = (DcMeteorologicalDetectorData) msg.get("properties");
// DcMeteorologicalDetectorData meteorologicalDetectorData = (DcMeteorologicalDetectorData) msg.get("properties");
JSONObject jsonObject = (JSONObject) msg.get("properties");
DcMeteorologicalDetectorData meteorologicalDetectorData = jsonObject.toJavaObject(DcMeteorologicalDetectorData.class);
JSONObject jsonObjectHeaders = (JSONObject)msg.get("headers");
String parts = jsonObjectHeaders.getString("deviceName");
String[] strings = parts.split("-");
String deviceName = strings[0];
String stakeMark = strings[1];
String direction = strings[2];
//设备名称
meteorologicalDetectorData.setDeviceName(deviceName);
//位置
meteorologicalDetectorData.setStakeMark(stakeMark);
//方向
meteorologicalDetectorData.setDirection(direction);
meteorologicalDetectorData.setIotDeviceId(msg.get("deviceId").toString());
meteorologicalDetectorDataService.insertDcMeteorologicalDetectorData(meteorologicalDetectorData);

6
zc-business/src/main/java/com/zc/business/service/IDcMeteorologicalDetectorDataService.java

@ -1,6 +1,8 @@
package com.zc.business.service;
import java.util.List;
import java.util.Map;
import com.zc.business.domain.DcMeteorologicalDetectorData;
import com.zc.business.domain.MdDeviceData;
@ -59,4 +61,8 @@ public interface IDcMeteorologicalDetectorDataService
* @return 结果
*/
int deleteDcMeteorologicalDetectorDataById(Long id);
//统计当天 没小时温度
List<Map<String,String>> selectStatistics(String deviceName);
List<DcMeteorologicalDetectorData> selectlistAll(DcMeteorologicalDetectorData dcMeteorologicalDetectorData);
}

14
zc-business/src/main/java/com/zc/business/service/impl/DcMeteorologicalDetectorDataServiceImpl.java

@ -1,9 +1,12 @@
package com.zc.business.service.impl;
import java.util.List;
import java.util.Map;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.zc.business.domain.DcDevice;
import com.zc.business.domain.MdDeviceData;
import org.springframework.beans.factory.annotation.Autowired;
@ -57,6 +60,7 @@ public class DcMeteorologicalDetectorDataServiceImpl implements IDcMeteorologica
@Override
public int insertDcMeteorologicalDetectorData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData)
{
dcMeteorologicalDetectorData.setCreateTime(DateUtils.getNowDate());
return dcMeteorologicalDetectorDataMapper.insertDcMeteorologicalDetectorData(dcMeteorologicalDetectorData);
}
@ -95,4 +99,14 @@ public class DcMeteorologicalDetectorDataServiceImpl implements IDcMeteorologica
{
return dcMeteorologicalDetectorDataMapper.deleteDcMeteorologicalDetectorDataById(id);
}
@Override
public List<Map<String,String>> selectStatistics(String deviceName) {
return dcMeteorologicalDetectorDataMapper.selectStatistics(deviceName);
}
@Override
public List<DcMeteorologicalDetectorData> selectlistAll(DcMeteorologicalDetectorData dcMeteorologicalDetectorData) {
return dcMeteorologicalDetectorDataMapper.selectlistAll(dcMeteorologicalDetectorData);
}
}

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

@ -4,59 +4,56 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zc.business.mapper.DcMeteorologicalDetectorDataMapper">
<resultMap type="DcMeteorologicalDetectorData" id="DcMeteorologicalDetectorDataResult">
<resultMap type="com.zc.business.domain.DcMeteorologicalDetectorData" id="DcMeteorologicalDetectorDataResult">
<result property="id" column="id" />
<result property="iotDeviceId" column="iot_device_id" />
<result property="rainfall" column="rainfall" />
<result property="visibilityType" column="visibility_type" />
<result property="visibility" column="visibility" />
<result property="roadSurfaceStatus" column="road_surface_status" />
<result property="atmosphericPressure" column="atmospheric_pressure" />
<result property="temperature" column="temperature" />
<result property="humidity" column="humidity" />
<result property="windDirection" column="wind_direction" />
<result property="windSpeed" column="wind_speed" />
<result property="freezingPointTemperature" column="freezing_point_temperature" />
<result property="salinityValue" column="salinity_value" />
<result property="roadSurfaceTemperature" column="road_surface_temperature" />
<result property="waterFilmThickness" column="water_film_thickness" />
<result property="precipitationType" column="precipitation_type" />
<result property="wetSlipperyCoefficient" column="wet_slippery_coefficient" />
<result property="sensorTemperature" column="sensor_temperature" />
<result property="remoteRoadSurfaceTemperature" column="remote_road_surface_temperature" />
<result property="remoteRoadSurfaceStatus" column="remote_road_surface_status" />
<result property="subSurfaceTemperature" column="sub_surface_temperature" />
<result property="waterFilmIceSnowValue" column="water_film_ice_snow_value" />
<result property="createTime" column="create_time" />
<result property="deviceName" column="device_name" />
<result property="stakeMark" column="stake_mark" />
<result property="direction" column="direction" />
</resultMap>
<resultMap type="map" id="countMap">
<result property="timeSlot" column="time_slot" />
<result property="date" column="date" />
<result property="avgTemperature" column="avg_temperature" />
<result property="avgVisibility" column="avg_visibility" />
</resultMap>
<sql id="selectDcMeteorologicalDetectorDataVo">
select id, iot_device_id, rainfall, visibility_type, visibility, road_surface_status, atmospheric_pressure, temperature, humidity, wind_direction, wind_speed, freezing_point_temperature, salinity_value, road_surface_temperature, water_film_thickness, precipitation_type, wet_slippery_coefficient, sensor_temperature, remote_road_surface_temperature, remote_road_surface_status, sub_surface_temperature, water_film_ice_snow_value,create_time from dc_meteorological_detector_data
select id, iot_device_id, rainfall, visibility_type, visibility, atmospheric_pressure, temperature, humidity, wind_direction, wind_speed, precipitation_type, wet_slippery_coefficient,remote_road_surface_temperature, remote_road_surface_status, water_film_ice_snow_value,create_time,stake_mark,device_name,direction from dc_meteorological_detector_data
</sql>
<select id="selectDcMeteorologicalDetectorDataList" parameterType="DcMeteorologicalDetectorData" resultMap="DcMeteorologicalDetectorDataResult">
<select id="selectDcMeteorologicalDetectorDataList" parameterType="com.zc.business.domain.DcMeteorologicalDetectorData" resultMap="DcMeteorologicalDetectorDataResult">
<include refid="selectDcMeteorologicalDetectorDataVo"/>
<where>
<if test="iotDeviceId != null and iotDeviceId != ''"> and iot_device_id = #{iotDeviceId}</if>
<if test="direction != null and direction != ''"> and direction = #{direction}</if>
<if test="stakeMark != null and stakeMark != ''"> and stake_mark = #{stakeMark}</if>
<if test="deviceName != null and deviceName != ''"> and device_name = #{deviceName}</if>
<if test="rainfall != null and rainfall != ''"> and rainfall = #{rainfall}</if>
<if test="visibilityType != null and visibilityType != ''"> and visibility_type = #{visibilityType}</if>
<if test="visibility != null and visibility != ''"> and visibility = #{visibility}</if>
<if test="roadSurfaceStatus != null and roadSurfaceStatus != ''"> and road_surface_status = #{roadSurfaceStatus}</if>
<if test="atmosphericPressure != null and atmosphericPressure != ''"> and atmospheric_pressure = #{atmosphericPressure}</if>
<if test="temperature != null and temperature != ''"> and temperature = #{temperature}</if>
<if test="humidity != null and humidity != ''"> and humidity = #{humidity}</if>
<if test="windDirection != null and windDirection != ''"> and wind_direction = #{windDirection}</if>
<if test="windSpeed != null and windSpeed != ''"> and wind_speed = #{windSpeed}</if>
<if test="freezingPointTemperature != null and freezingPointTemperature != ''"> and freezing_point_temperature = #{freezingPointTemperature}</if>
<if test="salinityValue != null and salinityValue != ''"> and salinity_value = #{salinityValue}</if>
<if test="roadSurfaceTemperature != null and roadSurfaceTemperature != ''"> and road_surface_temperature = #{roadSurfaceTemperature}</if>
<if test="waterFilmThickness != null and waterFilmThickness != ''"> and water_film_thickness = #{waterFilmThickness}</if>
<if test="precipitationType != null and precipitationType != ''"> and precipitation_type = #{precipitationType}</if>
<if test="wetSlipperyCoefficient != null and wetSlipperyCoefficient != ''"> and wet_slippery_coefficient = #{wetSlipperyCoefficient}</if>
<if test="sensorTemperature != null and sensorTemperature != ''"> and sensor_temperature = #{sensorTemperature}</if>
<if test="remoteRoadSurfaceTemperature != null and remoteRoadSurfaceTemperature != ''"> and remote_road_surface_temperature = #{remoteRoadSurfaceTemperature}</if>
<if test="remoteRoadSurfaceStatus != null and remoteRoadSurfaceStatus != ''"> and remote_road_surface_status = #{remoteRoadSurfaceStatus}</if>
<if test="subSurfaceTemperature != null and subSurfaceTemperature != ''"> and sub_surface_temperature = #{subSurfaceTemperature}</if>
<if test="waterFilmIceSnowValue != null and waterFilmIceSnowValue != ''"> and water_film_ice_snow_value = #{waterFilmIceSnowValue}</if>
</where>
</select>
@ -66,81 +63,69 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</select>
<insert id="insertDcMeteorologicalDetectorData" parameterType="DcMeteorologicalDetectorData" useGeneratedKeys="true" keyProperty="id">
<insert id="insertDcMeteorologicalDetectorData" parameterType="com.zc.business.domain.DcMeteorologicalDetectorData" useGeneratedKeys="true" keyProperty="id">
insert into dc_meteorological_detector_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="iotDeviceId != null">iot_device_id,</if>
<if test="direction != null">direction,</if>
<if test="stakeMark != null">stake_mark,</if>
<if test="deviceName != null">device_name,</if>
<if test="rainfall != null">rainfall,</if>
<if test="visibilityType != null">visibility_type,</if>
<if test="visibility != null">visibility,</if>
<if test="roadSurfaceStatus != null">road_surface_status,</if>
<if test="atmosphericPressure != null">atmospheric_pressure,</if>
<if test="temperature != null">temperature,</if>
<if test="humidity != null">humidity,</if>
<if test="windDirection != null">wind_direction,</if>
<if test="windSpeed != null">wind_speed,</if>
<if test="freezingPointTemperature != null">freezing_point_temperature,</if>
<if test="salinityValue != null">salinity_value,</if>
<if test="roadSurfaceTemperature != null">road_surface_temperature,</if>
<if test="waterFilmThickness != null">water_film_thickness,</if>
<if test="precipitationType != null">precipitation_type,</if>
<if test="wetSlipperyCoefficient != null">wet_slippery_coefficient,</if>
<if test="sensorTemperature != null">sensor_temperature,</if>
<if test="remoteRoadSurfaceTemperature != null">remote_road_surface_temperature,</if>
<if test="remoteRoadSurfaceStatus != null">remote_road_surface_status,</if>
<if test="subSurfaceTemperature != null">sub_surface_temperature,</if>
<if test="waterFilmIceSnowValue != null">water_film_ice_snow_value,</if>
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="iotDeviceId != null">#{iotDeviceId},</if>
<if test="direction != null">#{direction},</if>
<if test="stakeMark != null">#{stakeMark},</if>
<if test="deviceName != null">#{deviceName},</if>
<if test="rainfall != null">#{rainfall},</if>
<if test="visibilityType != null">#{visibilityType},</if>
<if test="visibility != null">#{visibility},</if>
<if test="roadSurfaceStatus != null">#{roadSurfaceStatus},</if>
<if test="atmosphericPressure != null">#{atmosphericPressure},</if>
<if test="temperature != null">#{temperature},</if>
<if test="humidity != null">#{humidity},</if>
<if test="windDirection != null">#{windDirection},</if>
<if test="windSpeed != null">#{windSpeed},</if>
<if test="freezingPointTemperature != null">#{freezingPointTemperature},</if>
<if test="salinityValue != null">#{salinityValue},</if>
<if test="roadSurfaceTemperature != null">#{roadSurfaceTemperature},</if>
<if test="waterFilmThickness != null">#{waterFilmThickness},</if>
<if test="precipitationType != null">#{precipitationType},</if>
<if test="wetSlipperyCoefficient != null">#{wetSlipperyCoefficient},</if>
<if test="sensorTemperature != null">#{sensorTemperature},</if>
<if test="remoteRoadSurfaceTemperature != null">#{remoteRoadSurfaceTemperature},</if>
<if test="remoteRoadSurfaceStatus != null">#{remoteRoadSurfaceStatus},</if>
<if test="subSurfaceTemperature != null">#{subSurfaceTemperature},</if>
<if test="waterFilmIceSnowValue != null">#{waterFilmIceSnowValue},</if>
current_date
CURRENT_TIMESTAMP
</trim>
</insert>
<update id="updateDcMeteorologicalDetectorData" parameterType="DcMeteorologicalDetectorData">
<update id="updateDcMeteorologicalDetectorData" parameterType="com.zc.business.domain.DcMeteorologicalDetectorData">
update dc_meteorological_detector_data
<trim prefix="SET" suffixOverrides=",">
<if test="iotDeviceId != null">iot_device_id = #{iotDeviceId},</if>
<if test="direction != null">iot_device_id = #{direction},</if>
<if test="deviceName != null">device_name = #{deviceName},</if>
<if test="stakeMark != null">stake_mark = #{stakeMark},</if>
<if test="rainfall != null">rainfall = #{rainfall},</if>
<if test="visibilityType != null">visibility_type = #{visibilityType},</if>
<if test="visibility != null">visibility = #{visibility},</if>
<if test="roadSurfaceStatus != null">road_surface_status = #{roadSurfaceStatus},</if>
<if test="atmosphericPressure != null">atmospheric_pressure = #{atmosphericPressure},</if>
<if test="temperature != null">temperature = #{temperature},</if>
<if test="humidity != null">humidity = #{humidity},</if>
<if test="windDirection != null">wind_direction = #{windDirection},</if>
<if test="windSpeed != null">wind_speed = #{windSpeed},</if>
<if test="freezingPointTemperature != null">freezing_point_temperature = #{freezingPointTemperature},</if>
<if test="salinityValue != null">salinity_value = #{salinityValue},</if>
<if test="roadSurfaceTemperature != null">road_surface_temperature = #{roadSurfaceTemperature},</if>
<if test="waterFilmThickness != null">water_film_thickness = #{waterFilmThickness},</if>
<if test="precipitationType != null">precipitation_type = #{precipitationType},</if>
<if test="wetSlipperyCoefficient != null">wet_slippery_coefficient = #{wetSlipperyCoefficient},</if>
<if test="sensorTemperature != null">sensor_temperature = #{sensorTemperature},</if>
<if test="remoteRoadSurfaceTemperature != null">remote_road_surface_temperature = #{remoteRoadSurfaceTemperature},</if>
<if test="remoteRoadSurfaceStatus != null">remote_road_surface_status = #{remoteRoadSurfaceStatus},</if>
<if test="subSurfaceTemperature != null">sub_surface_temperature = #{subSurfaceTemperature},</if>
<if test="waterFilmIceSnowValue != null">water_film_ice_snow_value = #{waterFilmIceSnowValue},</if>
</trim>
where id = #{id}
@ -156,4 +141,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="selectStatistics" resultMap="countMap" resultType="map">
WITH hours AS (
SELECT h AS time_slot
FROM (
SELECT 0 AS h UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4
UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9
UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 UNION ALL SELECT 13
UNION ALL SELECT 14 UNION ALL SELECT 15 UNION ALL SELECT 16 UNION ALL SELECT 17
UNION ALL SELECT 18 UNION ALL SELECT 19 UNION ALL SELECT 20 UNION ALL SELECT 21
UNION ALL SELECT 22 UNION ALL SELECT 23
) AS all_hours
)
SELECT
h.time_slot,
DATE(dc.create_time) AS date,
COALESCE(ROUND(AVG(dc.temperature), 2), 0) AS avg_temperature,
COALESCE(ROUND(AVG(dc.visibility), 2), 0) AS avg_visibility
FROM
hours h
LEFT JOIN
dc_meteorological_detector_data dc
ON
DATE(dc.create_time) = CURDATE()
AND HOUR(dc.create_time) = h.time_slot
AND dc.device_name = #{deviceName}
GROUP BY
h.time_slot,
date;
</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;
</select>
</mapper>
Loading…
Cancel
Save