| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?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.WatchAccelerometerDataMapper">
- <resultMap id="BaseResultMap" type="com.fs.watch.domain.WatchAccelerometerData">
- <result property="id" column="id" jdbcType="OTHER" typeHandler="com.fs.watch.handler.UUIDTypeHandler"/>
- <result property="deviceId" column="device_id" jdbcType="VARCHAR"/>
- <result property="x" column="json_data.x" jdbcType="OTHER" typeHandler="com.fs.watch.handler.ArrayTypeHandler"/>
- <result property="y" column="json_data.y" jdbcType="OTHER" typeHandler="com.fs.watch.handler.ArrayTypeHandler"/>
- <result property="z" column="json_data.z" jdbcType="OTHER" typeHandler="com.fs.watch.handler.ArrayTypeHandler"/>
- <result property="createTime" column="create_time" jdbcType="VARCHAR"/>
- </resultMap>
- <sql id="Base_Column_List">
- id, device_id, json_data.x, json_data.y, json_data.z, create_time
- </sql>
- <update id="insert" parameterType="com.fs.watch.domain.WatchAccelerometerData">
- INSERT INTO watch_accelerometer_data
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="data.id != null and data.id != ''">
- id,
- </if>
- <if test="data.deviceId != null and data.deviceId != ''">
- device_id,
- </if>
- <if test="data.x != null">
- `json_data.x`,
- </if>
- <if test="data.y != null">
- `json_data.y`,
- </if>
- <if test="data.z != null">
- `json_data.z`,
- </if>
- <if test="data.createTime != null and data.createTime != ''">
- create_time,
- </if>
- </trim>
- <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
- <if test="data.id != null and data.id != ''">
- #{data.id},
- </if>
- <if test="data.deviceId != null and data.deviceId != ''">
- #{data.deviceId},
- </if>
- <if test="data.x != null">
- #{data.x, typeHandler=com.fs.watchApi.handler.ArrayTypeHandler},
- </if>
- <if test="data.y != null">
- #{data.y, typeHandler=com.fs.watchApi.handler.ArrayTypeHandler},
- </if>
- <if test="data.z != null">
- #{data.z, typeHandler=com.fs.watchApi.handler.ArrayTypeHandler},
- </if>
- <if test="data.createTime != null and data.createTime != ''">
- #{data.createTime},
- </if>
- </trim>
- </update>
- <select id="queryByCreateTime" resultType="java.lang.Integer">
- SELECT COUNT(*) FROM watch_accelerometer_data WHERE create_time = #{createTime}
- </select>
- <select id="getLastByDeviceId" resultMap="BaseResultMap">
- select * from watch_accelerometer_data where device_id like #{deviceId} order by create_time desc limit 1
- </select>
- </mapper>
|