| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?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.fs.watch.mapper.WatchMultiLeadsEcgDataMapper">
- <resultMap id="BaseResultMap" type="com.fs.watch.domain.WatchMultiLeadsEcgData">
- <result property="id" column="id" jdbcType="OTHER" typeHandler="com.fs.watch.handler.UUIDTypeHandler"/>
- <result property="deviceId" column="device_id" jdbcType="VARCHAR"/>
- <result property="channel" column="channel" jdbcType="INTEGER"/>
- <result property="singleChannelLength" column="single_channel_length" jdbcType="INTEGER"/>
- <result property="channels" column="json_data.channel" jdbcType="ARRAY" typeHandler="com.fs.watch.handler.IntegerArrayTypeHandler"/>
- <result property="val" column="json_data.val" jdbcType="ARRAY" typeHandler="com.fs.watch.handler.IntegerArrayTypeHandler"/>
- <result property="createTime" column="create_time" jdbcType="VARCHAR"/>
- </resultMap>
- <sql id="Base_Column_List">
- id,device_id,channel,
- single_channel_length,json_data.channel,json_data.val,
- create_time
- </sql>
- <!-- 插入多导联心电图数据 -->
- <update id="insert" parameterType="com.fs.watch.domain.WatchMultiLeadsEcgData">
- INSERT INTO watch_multi_leads_ecg_data
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="data.id != null">
- id,
- </if>
- <if test="data.deviceId != null">
- device_id,
- </if>
- <if test="data.channel != null">
- channel,
- </if>
- <if test="data.singleChannelLength != null">
- single_channel_length,
- </if>
- <if test="data.channels != null">
- json_data.channel,
- </if>
- <if test="data.val != null">
- json_data.val,
- </if>
- <if test="data.createTime != null">
- create_time,
- </if>
- </trim>
- <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
- <if test="data.id != null">
- #{data.id},
- </if>
- <if test="data.deviceId != null">
- #{data.deviceId},
- </if>
- <if test="data.channel != null">
- #{data.channel},
- </if>
- <if test="data.singleChannelLength != null">
- #{data.singleChannelLength},
- </if>
- <if test="data.channels != null">
- #{data.channels},
- </if>
- <if test="data.val != null">
- #{data.val},
- </if>
- <if test="data.createTime != null">
- #{data.createTime},
- </if>
- </trim>
- </update>
- <!-- 查询数据是否存在 -->
- <select id="queryByCreateTime" resultType="java.lang.Integer">
- SELECT COUNT(*)
- FROM watch_multi_leads_ecg_data
- WHERE create_time = #{createTime}
- </select>
- <select id="getLastByDeviceId" resultMap="BaseResultMap">
- select * from watch_multi_leads_ecg_data where device_id like #{deviceId} order by create_time desc limit 1
- </select>
- </mapper>
|