Files
agricultural-monitoring-api/fastbee-service/fastbee-deviceData-service/src/main/resources/mapper.deviceData/DeviceMiceRealtimeMapper.xml
2024-11-07 14:37:54 +08:00

111 lines
6.1 KiB
XML

<?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.fastbee.deviceData.mapper.DeviceMiceRealtimeMapper">
<resultMap type="DeviceMiceRealtime" id="DeviceMiceRealtimeResult">
<result property="id" column="id" />
<result property="feedDelivery" column="feed_delivery" />
<result property="infraredDetection" column="infrared_detection" />
<result property="export" column="export" />
<result property="fillLight" column="fill_light" />
<result property="weight" column="weight" />
<result property="lng" column="lng" />
<result property="lat" column="lat" />
<result property="workingMode" column="working_mode" />
<result property="netWeight" column="net_weight" />
<result property="takePicture" column="take_picture" />
<result property="deviceAddr" column="device_addr" />
<result property="truthStatus" column="truth_status" />
</resultMap>
<sql id="selectDeviceMiceRealtimeVo">
select id, feed_delivery, infrared_detection, export, fill_light, weight, lng, lat, working_mode, net_weight, take_picture, device_addr, truth_status from iot_device_mice_realtime
</sql>
<select id="selectDeviceMiceRealtimeList" parameterType="DeviceMiceRealtime" resultMap="DeviceMiceRealtimeResult">
<include refid="selectDeviceMiceRealtimeVo"/>
<where>
<if test="feedDelivery != null and feedDelivery != ''"> and feed_delivery = #{feedDelivery}</if>
<if test="infraredDetection != null and infraredDetection != ''"> and infrared_detection = #{infraredDetection}</if>
<if test="export != null and export != ''"> and export = #{export}</if>
<if test="fillLight != null and fillLight != ''"> and fill_light = #{fillLight}</if>
<if test="weight != null and weight != ''"> and weight = #{weight}</if>
<if test="lng != null and lng != ''"> and lng = #{lng}</if>
<if test="lat != null and lat != ''"> and lat = #{lat}</if>
<if test="workingMode != null and workingMode != ''"> and working_mode = #{workingMode}</if>
<if test="netWeight != null and netWeight != ''"> and net_weight = #{netWeight}</if>
<if test="takePicture != null and takePicture != ''"> and take_picture = #{takePicture}</if>
<if test="deviceAddr != null and deviceAddr != ''"> and device_addr = #{deviceAddr}</if>
<if test="truthStatus != null and truthStatus != ''"> and truth_status = #{truthStatus}</if>
</where>
</select>
<select id="selectDeviceMiceRealtimeById" parameterType="Long" resultMap="DeviceMiceRealtimeResult">
<include refid="selectDeviceMiceRealtimeVo"/>
where id = #{id}
</select>
<insert id="insertDeviceMiceRealtime" parameterType="DeviceMiceRealtime" useGeneratedKeys="true" keyProperty="id">
insert into iot_device_mice_realtime
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="feedDelivery != null">feed_delivery,</if>
<if test="infraredDetection != null">infrared_detection,</if>
<if test="export != null">export,</if>
<if test="fillLight != null">fill_light,</if>
<if test="weight != null">weight,</if>
<if test="lng != null">lng,</if>
<if test="lat != null">lat,</if>
<if test="workingMode != null">working_mode,</if>
<if test="netWeight != null">net_weight,</if>
<if test="takePicture != null">take_picture,</if>
<if test="deviceAddr != null">device_addr,</if>
<if test="truthStatus != null">truth_status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="feedDelivery != null">#{feedDelivery},</if>
<if test="infraredDetection != null">#{infraredDetection},</if>
<if test="export != null">#{export},</if>
<if test="fillLight != null">#{fillLight},</if>
<if test="weight != null">#{weight},</if>
<if test="lng != null">#{lng},</if>
<if test="lat != null">#{lat},</if>
<if test="workingMode != null">#{workingMode},</if>
<if test="netWeight != null">#{netWeight},</if>
<if test="takePicture != null">#{takePicture},</if>
<if test="deviceAddr != null">#{deviceAddr},</if>
<if test="truthStatus != null">#{truthStatus},</if>
</trim>
</insert>
<update id="updateDeviceMiceRealtime" parameterType="DeviceMiceRealtime">
update iot_device_mice_realtime
<trim prefix="SET" suffixOverrides=",">
<if test="feedDelivery != null">feed_delivery = #{feedDelivery},</if>
<if test="infraredDetection != null">infrared_detection = #{infraredDetection},</if>
<if test="export != null">export = #{export},</if>
<if test="fillLight != null">fill_light = #{fillLight},</if>
<if test="weight != null">weight = #{weight},</if>
<if test="lng != null">lng = #{lng},</if>
<if test="lat != null">lat = #{lat},</if>
<if test="workingMode != null">working_mode = #{workingMode},</if>
<if test="netWeight != null">net_weight = #{netWeight},</if>
<if test="takePicture != null">take_picture = #{takePicture},</if>
<if test="deviceAddr != null">device_addr = #{deviceAddr},</if>
<if test="truthStatus != null">truth_status = #{truthStatus},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDeviceMiceRealtimeById" parameterType="Long">
delete from iot_device_mice_realtime where id = #{id}
</delete>
<delete id="deleteDeviceMiceRealtimeByIds" parameterType="String">
delete from iot_device_mice_realtime where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>