feat:添加安防小板设备相关接口

This commit is contained in:
listom
2024-08-13 11:22:26 +08:00
parent e0389a15da
commit 6822b5f354
7 changed files with 549 additions and 15 deletions

View File

@ -0,0 +1,97 @@
<?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.iot.mapper.UploadedPhotosMapper">
<resultMap type="com.fastbee.iot.model.anfang.UploadedPhotos" id="UploadedPhotosResult">
<result property="id" column="id" />
<result property="photoPath" column="photo_path" />
<result property="imei" column="imei" />
<result property="sn" column="sn" />
<result property="lat" column="lat" />
<result property="lng" column="lng" />
<result property="temp" column="temp" />
<result property="doorState" column="door_state" />
<result property="shakeState" column="shake_state" />
<result property="uploadTime" column="upload_time" />
</resultMap>
<sql id="selectUploadedPhotosVo">
select id, photo_path, imei, sn, lat, lng, temp, door_state, shake_state, upload_time from uploaded_photos
</sql>
<select id="selectUploadedPhotosList" parameterType="com.fastbee.iot.model.anfang.UploadedPhotos" resultMap="UploadedPhotosResult">
<include refid="selectUploadedPhotosVo"/>
<where>
<if test="photoPath != null and photoPath != ''"> and photo_path = #{photoPath}</if>
<if test="imei != null and imei != ''"> and imei = #{imei}</if>
<if test="sn != null and sn != ''"> and sn like concat('%', #{sn}, '%')</if>
<if test="lat != null "> and lat = #{lat}</if>
<if test="lng != null "> and lng = #{lng}</if>
<if test="params.beginTemp != null and params.beginTemp != '' and params.endTemp != null and params.endTemp != ''"> and temp between #{params.beginTemp} and #{params.endTemp}</if>
<if test="doorState != null and doorState != ''"> and door_state = #{doorState}</if>
<if test="shakeState != null and shakeState != ''"> and shake_state = #{shakeState}</if>
<if test="params.beginUploadTime != null and params.beginUploadTime != '' and params.endUploadTime != null and params.endUploadTime != ''"> and upload_time between #{params.beginUploadTime} and #{params.endUploadTime}</if>
</where>
order by id desc
</select>
<select id="selectUploadedPhotosById" parameterType="Long" resultMap="UploadedPhotosResult">
<include refid="selectUploadedPhotosVo"/>
where id = #{id}
</select>
<insert id="insertUploadedPhotos" parameterType="com.fastbee.iot.model.anfang.UploadedPhotos" useGeneratedKeys="true" keyProperty="id">
insert into uploaded_photos
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="photoPath != null and photoPath != ''">photo_path,</if>
<if test="imei != null and imei != ''">imei,</if>
<if test="sn != null">sn,</if>
<if test="lat != null">lat,</if>
<if test="lng != null">lng,</if>
<if test="temp != null">temp,</if>
<if test="doorState != null">door_state,</if>
<if test="shakeState != null">shake_state,</if>
<if test="uploadTime != null">upload_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="photoPath != null and photoPath != ''">#{photoPath},</if>
<if test="imei != null and imei != ''">#{imei},</if>
<if test="sn != null">#{sn},</if>
<if test="lat != null">#{lat},</if>
<if test="lng != null">#{lng},</if>
<if test="temp != null">#{temp},</if>
<if test="doorState != null">#{doorState},</if>
<if test="shakeState != null">#{shakeState},</if>
<if test="uploadTime != null">#{uploadTime},</if>
</trim>
</insert>
<update id="updateUploadedPhotos" parameterType="com.fastbee.iot.model.anfang.UploadedPhotos">
update uploaded_photos
<trim prefix="SET" suffixOverrides=",">
<if test="photoPath != null and photoPath != ''">photo_path = #{photoPath},</if>
<if test="imei != null and imei != ''">imei = #{imei},</if>
<if test="sn != null">sn = #{sn},</if>
<if test="lat != null">lat = #{lat},</if>
<if test="lng != null">lng = #{lng},</if>
<if test="temp != null">temp = #{temp},</if>
<if test="doorState != null">door_state = #{doorState},</if>
<if test="shakeState != null">shake_state = #{shakeState},</if>
<if test="uploadTime != null">upload_time = #{uploadTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteUploadedPhotosById" parameterType="Long">
delete from uploaded_photos where id = #{id}
</delete>
<delete id="deleteUploadedPhotosByIds" parameterType="String">
delete from uploaded_photos where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>