| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?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.WatchPpgDataMapper">
- <resultMap id="BaseResultMap" type="com.fs.watch.domain.WatchPpgData">
- <result property="id" column="id" jdbcType="OTHER" typeHandler="com.fs.watch.handler.UUIDTypeHandler"/>
- <result property="deviceId" column="device_id" jdbcType="VARCHAR"/>
- <result property="fval" column="json_data.fval" jdbcType="ARRAY" typeHandler="com.fs.watch.handler.IntegerArrayTypeHandler"/>
- <result property="sval" column="json_data.sval" 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,json_data.fval,
- json_data.sval,create_time
- </sql>
- <!-- 插入血糖数据 -->
- <update id="insert" parameterType="com.fs.watch.domain.WatchPpgData">
- INSERT INTO watch_ppg_data
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="data.id != null">
- id,
- </if>
- <if test="data.deviceId != null">
- device_id,
- </if>
- <if test="data.fval != null">
- json_data.fval,
- </if>
- <if test="data.sval != null">
- json_data.sval,
- </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.fval != null">
- #{data.fval},
- </if>
- <if test="data.sval != null">
- #{data.sval},
- </if>
- <if test="data.createTime != null">
- #{data.createTime},
- </if>
- </trim>
- </update>
- <!-- 查询数据是否存在 -->
- <select id="queryByCreateTime" resultType="java.lang.Integer">
- SELECT COUNT(*)
- FROM watch_ppg_data
- WHERE create_time = #{createTime}
- </select>
- <select id="getLastByDeviceId" resultMap="BaseResultMap">
- select * from watch_ppg_data where device_id like #{deviceId} order by create_time desc limit 1
- </select>
- </mapper>
|