|
@@ -0,0 +1,198 @@
|
|
|
+<?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.system.mapper.HeartBeatMapper">
|
|
|
+
|
|
|
+ <resultMap type="com.ruoyi.system.domain.HeartBeat" id="HeartBeatMap">
|
|
|
+ <result property="heartId" column="heart_id" jdbcType="INTEGER"/>
|
|
|
+ <result property="type" column="type" jdbcType="INTEGER"/>
|
|
|
+ <result property="id" column="id" jdbcType="VARCHAR"/>
|
|
|
+ <result property="status" column="status" jdbcType="INTEGER"/>
|
|
|
+ <result property="eq" column="eq" jdbcType="NUMERIC"/>
|
|
|
+ <result property="current" column="current" jdbcType="NUMERIC"/>
|
|
|
+ <result property="voltage" column="voltage" jdbcType="NUMERIC"/>
|
|
|
+ <result property="signalstrength" column="signalstrength" jdbcType="NUMERIC"/>
|
|
|
+ <result property="temperature" column="temperature" jdbcType="NUMERIC"/>
|
|
|
+ <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
|
|
+ <result property="siteId" column="site_id" jdbcType="INTEGER"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!--查询单个-->
|
|
|
+ <select id="queryById" resultMap="HeartBeatMap">
|
|
|
+ select
|
|
|
+heart_id, type, id, status, eq, current, voltage, signalstrength, temperature, create_time, site_id
|
|
|
+ from heart_beat
|
|
|
+ where heart_id = #{heartId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--查询单个-->
|
|
|
+ <select id="queryBysiteId" resultMap="HeartBeatMap">
|
|
|
+ select
|
|
|
+ heart_id, type, id, status, eq, current, voltage, signalstrength, temperature, create_time, site_id
|
|
|
+ from heart_beat
|
|
|
+ where site_id = #{siteId}
|
|
|
+ order by create_time desc
|
|
|
+ limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--查询指定行数据-->
|
|
|
+ <select id="queryAllByLimit" resultMap="HeartBeatMap">
|
|
|
+ select
|
|
|
+heart_id, type, id, status, eq, current, voltage, signalstrength, temperature, create_time, site_id
|
|
|
+ from heart_beat
|
|
|
+ <where>
|
|
|
+ <if test="heartId != null">
|
|
|
+ and heart_id = #{heartId}
|
|
|
+ </if>
|
|
|
+ <if test="type != null">
|
|
|
+ and type = #{type}
|
|
|
+ </if>
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ and id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ and status = #{status}
|
|
|
+ </if>
|
|
|
+ <if test="eq != null">
|
|
|
+ and eq = #{eq}
|
|
|
+ </if>
|
|
|
+ <if test="current != null">
|
|
|
+ and current = #{current}
|
|
|
+ </if>
|
|
|
+ <if test="voltage != null">
|
|
|
+ and voltage = #{voltage}
|
|
|
+ </if>
|
|
|
+ <if test="signalstrength != null">
|
|
|
+ and signalstrength = #{signalstrength}
|
|
|
+ </if>
|
|
|
+ <if test="temperature != null">
|
|
|
+ and temperature = #{temperature}
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ and create_time = #{createTime}
|
|
|
+ </if>
|
|
|
+ <if test="siteId != null">
|
|
|
+ and site_id = #{siteId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ limit #{pageable.offset}, #{pageable.pageSize}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--统计总行数-->
|
|
|
+ <select id="count" resultType="java.lang.Long">
|
|
|
+ select count(1)
|
|
|
+ from heart_beat
|
|
|
+ <where>
|
|
|
+ <if test="heartId != null">
|
|
|
+ and heart_id = #{heartId}
|
|
|
+ </if>
|
|
|
+ <if test="type != null">
|
|
|
+ and type = #{type}
|
|
|
+ </if>
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ and id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ and status = #{status}
|
|
|
+ </if>
|
|
|
+ <if test="eq != null">
|
|
|
+ and eq = #{eq}
|
|
|
+ </if>
|
|
|
+ <if test="current != null">
|
|
|
+ and current = #{current}
|
|
|
+ </if>
|
|
|
+ <if test="voltage != null">
|
|
|
+ and voltage = #{voltage}
|
|
|
+ </if>
|
|
|
+ <if test="signalstrength != null">
|
|
|
+ and signalstrength = #{signalstrength}
|
|
|
+ </if>
|
|
|
+ <if test="temperature != null">
|
|
|
+ and temperature = #{temperature}
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ and create_time = #{createTime}
|
|
|
+ </if>
|
|
|
+ <if test="siteId != null">
|
|
|
+ and site_id = #{siteId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--新增所有列-->
|
|
|
+ <insert id="insert" keyProperty="heartId" useGeneratedKeys="true">
|
|
|
+ insert into heart_beat(type, id, status, eq, current, voltage, signalstrength, temperature, create_time, site_id)
|
|
|
+ values (#{type}, #{id}, #{status}, #{eq}, #{current}, #{voltage}, #{signalstrength}, #{temperature}, #{createTime}, #{siteId})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="insertBatch" keyProperty="heartId" useGeneratedKeys="true">
|
|
|
+ insert into heart_beat(type, id, status, eq, current, voltage, signalstrength, temperature, create_time, site_id)
|
|
|
+ values
|
|
|
+ <foreach collection="entities" item="entity" separator=",">
|
|
|
+ (#{entity.type}, #{entity.id}, #{entity.status}, #{entity.eq}, #{entity.current}, #{entity.voltage}, #{entity.signalstrength}, #{entity.temperature}, #{entity.createTime}, #{entity.siteId})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="insertOrUpdateBatch" keyProperty="heartId" useGeneratedKeys="true">
|
|
|
+ insert into heart_beat(type, id, status, eq, current, voltage, signalstrength, temperature, create_time, site_id)
|
|
|
+ values
|
|
|
+ <foreach collection="entities" item="entity" separator=",">
|
|
|
+ (#{entity.type}, #{entity.id}, #{entity.status}, #{entity.eq}, #{entity.current}, #{entity.voltage}, #{entity.signalstrength}, #{entity.temperature}, #{entity.createTime}, #{entity.siteId})
|
|
|
+ </foreach>
|
|
|
+ on duplicate key update
|
|
|
+type = values(type),
|
|
|
+id = values(id),
|
|
|
+status = values(status),
|
|
|
+eq = values(eq),
|
|
|
+current = values(current),
|
|
|
+voltage = values(voltage),
|
|
|
+signalstrength = values(signalstrength),
|
|
|
+temperature = values(temperature),
|
|
|
+create_time = values(create_time),
|
|
|
+site_id = values(site_id)
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!--通过主键修改数据-->
|
|
|
+ <update id="update">
|
|
|
+ update heart_beat
|
|
|
+ <set>
|
|
|
+ <if test="type != null">
|
|
|
+ type = #{type},
|
|
|
+ </if>
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ id = #{id},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ status = #{status},
|
|
|
+ </if>
|
|
|
+ <if test="eq != null">
|
|
|
+ eq = #{eq},
|
|
|
+ </if>
|
|
|
+ <if test="current != null">
|
|
|
+ current = #{current},
|
|
|
+ </if>
|
|
|
+ <if test="voltage != null">
|
|
|
+ voltage = #{voltage},
|
|
|
+ </if>
|
|
|
+ <if test="signalstrength != null">
|
|
|
+ signalstrength = #{signalstrength},
|
|
|
+ </if>
|
|
|
+ <if test="temperature != null">
|
|
|
+ temperature = #{temperature},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time = #{createTime},
|
|
|
+ </if>
|
|
|
+ <if test="siteId != null">
|
|
|
+ site_id = #{siteId},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where heart_id = #{heartId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!--通过主键删除-->
|
|
|
+ <delete id="deleteById">
|
|
|
+ delete from heart_beat where heart_id = #{heartId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+</mapper>
|
|
|
+
|