|
|
@@ -0,0 +1,165 @@
|
|
|
+<?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.ruoyi.hhzx.qxsb.rk.mapper.WeatherRealtimeDataMapper">
|
|
|
+
|
|
|
+ <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" />
|
|
|
+ <result property="lightIntensity" column="light_intensity" />
|
|
|
+ <result property="collectTime" column="collect_time" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <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, 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="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>
|
|
|
+
|
|
|
+ <select id="selectWeatherRealtimeDataById" parameterType="Long" resultMap="WeatherRealtimeDataResult">
|
|
|
+ <include refid="selectWeatherRealtimeDataVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <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>
|
|
|
+ <if test="lightIntensity != null">light_intensity,</if>
|
|
|
+ <if test="collectTime != null">collect_time,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <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>
|
|
|
+ <if test="lightIntensity != null">#{lightIntensity},</if>
|
|
|
+ <if test="collectTime != null">#{collectTime},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <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="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>
|
|
|
+ <if test="lightIntensity != null">light_intensity = #{lightIntensity},</if>
|
|
|
+ <if test="collectTime != null">collect_time = #{collectTime},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <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>
|
|
|
+
|
|
|
+ <delete id="deleteWeatherRealtimeDataById" parameterType="Long">
|
|
|
+ delete from weather_realtime_data where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteWeatherRealtimeDataByIds" parameterType="String">
|
|
|
+ delete from weather_realtime_data where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|