|
|
@@ -4,12 +4,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.ruoyi.hhzx.qxsb.rk.mapper.WeatherRealtimeDataMapper">
|
|
|
|
|
|
- <resultMap type="WeatherRealtimeData" id="WeatherRealtimeDataResult">
|
|
|
+ <resultMap type="com.ruoyi.hhzx.qxsb.rk.domain.WeatherRealtimeData" id="WeatherRealtimeDataResult">
|
|
|
<result property="id" column="id" />
|
|
|
<result property="deviceId" column="device_id" />
|
|
|
<result property="temperature" column="temperature" />
|
|
|
<result property="humidity" column="humidity" />
|
|
|
<result property="rainfall" column="rainfall" />
|
|
|
+ <result property="rainfallA" column="rainfall_a" />
|
|
|
<result property="windDirection" column="wind_direction" />
|
|
|
<result property="windSpeed" column="wind_speed" />
|
|
|
<result property="airPressure" column="air_pressure" />
|
|
|
@@ -19,24 +20,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
<result property="createBy" column="create_by" />
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
+ <result property="soilTemperature" column="soil_temperature" />
|
|
|
+ <result property="soilHumidity" column="soil_humidity" />
|
|
|
+ <result property="soilN" column="soil_n" />
|
|
|
+ <result property="soilP" column="soil_p" />
|
|
|
+ <result property="soilK" column="soil_k" />
|
|
|
+
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectWeatherRealtimeDataVo">
|
|
|
- select id, device_id, temperature, humidity, rainfall, wind_direction, wind_speed, air_pressure, light_intensity, collect_time, create_time, update_time, create_by, update_by from weather_realtime_data
|
|
|
+ select id, device_id, temperature, humidity, rainfall, rainfall_a , wind_direction, wind_speed, air_pressure, light_intensity, collect_time, create_time, update_time, create_by, update_by, soil_temperature, soil_humidity, soil_n, soil_p, soil_k from weather_realtime_data
|
|
|
</sql>
|
|
|
|
|
|
- <select id="selectWeatherRealtimeDataList" parameterType="WeatherRealtimeData" resultMap="WeatherRealtimeDataResult">
|
|
|
+ <select id="selectWeatherRealtimeDataList" parameterType="com.ruoyi.hhzx.qxsb.rk.domain.WeatherRealtimeData" resultMap="WeatherRealtimeDataResult">
|
|
|
<include refid="selectWeatherRealtimeDataVo"/>
|
|
|
<where>
|
|
|
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
|
|
|
<if test="temperature != null "> and temperature = #{temperature}</if>
|
|
|
<if test="humidity != null "> and humidity = #{humidity}</if>
|
|
|
<if test="rainfall != null "> and rainfall = #{rainfall}</if>
|
|
|
+ <if test="rainfallA != null "> and rainfall_a = #{rainfall}</if>
|
|
|
<if test="windDirection != null and windDirection != ''"> and wind_direction = #{windDirection}</if>
|
|
|
<if test="windSpeed != null "> and wind_speed = #{windSpeed}</if>
|
|
|
<if test="airPressure != null "> and air_pressure = #{airPressure}</if>
|
|
|
<if test="lightIntensity != null "> and light_intensity = #{lightIntensity}</if>
|
|
|
<if test="collectTime != null "> and collect_time = #{collectTime}</if>
|
|
|
+ <if test="soilTemperature != null "> and soil_temperature = #{soilTemperature}</if>
|
|
|
+ <if test="soilHumidity != null "> and soil_humidity = #{soilHumidity}</if>
|
|
|
+ <if test="soilN != null "> and soil_n = #{soilN}</if>
|
|
|
+ <if test="soilP != null "> and soil_p = #{soilP}</if>
|
|
|
+ <if test="soilK != null "> and soil_k = #{soilK}</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
@@ -45,13 +58,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
where id = #{id}
|
|
|
</select>
|
|
|
|
|
|
- <insert id="insertWeatherRealtimeData" parameterType="WeatherRealtimeData" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ <select id="selectWeatherRealtimeDataLast" parameterType="Long" resultMap="WeatherRealtimeDataResult">
|
|
|
+ <include refid="selectWeatherRealtimeDataVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
|
|
|
+ <if test="temperature != null "> and temperature = #{temperature}</if>
|
|
|
+ <if test="humidity != null "> and humidity = #{humidity}</if>
|
|
|
+ <if test="rainfall != null "> and rainfall = #{rainfall}</if>
|
|
|
+ <if test="rainfallA != null "> and rainfall_a = #{rainfall}</if>
|
|
|
+ <if test="windDirection != null and windDirection != ''"> and wind_direction = #{windDirection}</if>
|
|
|
+ <if test="windSpeed != null "> and wind_speed = #{windSpeed}</if>
|
|
|
+ <if test="airPressure != null "> and air_pressure = #{airPressure}</if>
|
|
|
+ <if test="lightIntensity != null "> and light_intensity = #{lightIntensity}</if>
|
|
|
+ <if test="collectTime != null "> and collect_time = #{collectTime}</if>
|
|
|
+ <if test="soilTemperature != null "> and soil_temperature = #{soilTemperature}</if>
|
|
|
+ <if test="soilHumidity != null "> and soil_humidity = #{soilHumidity}</if>
|
|
|
+ <if test="soilN != null "> and soil_n = #{soilN}</if>
|
|
|
+ <if test="soilP != null "> and soil_p = #{soilP}</if>
|
|
|
+ <if test="soilK != null "> and soil_k = #{soilK}</if>
|
|
|
+ </where>
|
|
|
+ order by collect_time desc LIMIT 1;
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertWeatherRealtimeData" parameterType="com.ruoyi.hhzx.qxsb.rk.domain.WeatherRealtimeData" useGeneratedKeys="true" keyProperty="id">
|
|
|
insert into weather_realtime_data
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
<if test="deviceId != null and deviceId != ''">device_id,</if>
|
|
|
<if test="temperature != null">temperature,</if>
|
|
|
<if test="humidity != null">humidity,</if>
|
|
|
<if test="rainfall != null">rainfall,</if>
|
|
|
+ <if test="rainfallA != null ">rainfall_a,</if>
|
|
|
<if test="windDirection != null">wind_direction,</if>
|
|
|
<if test="windSpeed != null">wind_speed,</if>
|
|
|
<if test="airPressure != null">air_pressure,</if>
|
|
|
@@ -61,12 +97,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
+ <if test="soilTemperature != null">soil_temperature,</if>
|
|
|
+ <if test="soilHumidity != null">soil_humidity,</if>
|
|
|
+ <if test="soilN != null">soil_n,</if>
|
|
|
+ <if test="soilP != null">soil_p,</if>
|
|
|
+ <if test="soilK != null">soil_k,</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
|
|
|
<if test="temperature != null">#{temperature},</if>
|
|
|
<if test="humidity != null">#{humidity},</if>
|
|
|
<if test="rainfall != null">#{rainfall},</if>
|
|
|
+ <if test="rainfallA != null">#{rainfallA},</if>
|
|
|
<if test="windDirection != null">#{windDirection},</if>
|
|
|
<if test="windSpeed != null">#{windSpeed},</if>
|
|
|
<if test="airPressure != null">#{airPressure},</if>
|
|
|
@@ -76,16 +118,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="soilTemperature != null">#{soilTemperature},</if>
|
|
|
+ <if test="soilHumidity != null">#{soilHumidity},</if>
|
|
|
+ <if test="soilN != null">#{soilN},</if>
|
|
|
+ <if test="soilP != null">#{soilP},</if>
|
|
|
+ <if test="soilK != null">#{soilK},</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
|
- <update id="updateWeatherRealtimeData" parameterType="WeatherRealtimeData">
|
|
|
+ <update id="updateWeatherRealtimeData" parameterType="com.ruoyi.hhzx.qxsb.rk.domain.WeatherRealtimeData">
|
|
|
update weather_realtime_data
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
|
|
|
<if test="temperature != null">temperature = #{temperature},</if>
|
|
|
<if test="humidity != null">humidity = #{humidity},</if>
|
|
|
<if test="rainfall != null">rainfall = #{rainfall},</if>
|
|
|
+ <if test="rainfallA != null">rainfall_a = #{rainfall},</if>
|
|
|
<if test="windDirection != null">wind_direction = #{windDirection},</if>
|
|
|
<if test="windSpeed != null">wind_speed = #{windSpeed},</if>
|
|
|
<if test="airPressure != null">air_pressure = #{airPressure},</if>
|
|
|
@@ -95,6 +143,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ <if test="soilTemperature != null">soil_temperature = #{soilTemperature},</if>
|
|
|
+ <if test="soilHumidity != null">soil_humidity = #{soilHumidity},</if>
|
|
|
+ <if test="soilN != null">soil_n = #{soilN},</if>
|
|
|
+ <if test="soilP != null">soil_p = #{soilP},</if>
|
|
|
+ <if test="soilK != null">soil_k = #{soilK},</if>
|
|
|
</trim>
|
|
|
where id = #{id}
|
|
|
</update>
|