|
|
@@ -0,0 +1,112 @@
|
|
|
+<?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="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="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" />
|
|
|
+ </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
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectWeatherRealtimeDataList" parameterType="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="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>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectWeatherRealtimeDataById" parameterType="Long" resultMap="WeatherRealtimeDataResult">
|
|
|
+ <include refid="selectWeatherRealtimeDataVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertWeatherRealtimeData" parameterType="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="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>
|
|
|
+ </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="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>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateWeatherRealtimeData" parameterType="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="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>
|
|
|
+ </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>
|