| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <?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.WatchDeviceDataMapper">
- <resultMap id="BaseResultMap" type="com.fs.watch.domain.WatchDeviceData">
- <result property="id" column="id" jdbcType="OTHER" typeHandler="com.fs.watch.handler.UUIDTypeHandler"/>
- <result property="deviceId" column="device_id" jdbcType="VARCHAR"/>
- <result property="model" column="model" jdbcType="VARCHAR"/>
- <result property="version" column="version" jdbcType="VARCHAR"/>
- <result property="ble" column="ble" jdbcType="VARCHAR"/>
- <result property="sim" column="SIM" jdbcType="VARCHAR"/>
- <result property="isBind" column="isBind" jdbcType="BOOLEAN"/>
- <result property="createTime" column="create_time" jdbcType="VARCHAR"/>
- </resultMap>
- <sql id="Base_Column_List">
- id,device_id,model,
- version,ble,SIM,isBind,create_time
- </sql>
- <!-- 查询设备的插入时间 -->
- <select id="queryByCreateTime" resultType="java.lang.Integer">
- SELECT COUNT(*)
- FROM watch_device_data
- WHERE create_time = #{createTime}
- </select>
- <update id="insert" parameterType="com.fs.watch.domain.WatchDeviceData">
- INSERT INTO watch_device_data
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="data.id != null">
- id,
- </if>
- <if test="data.deviceId != null and data.deviceId!=''">
- device_id,
- </if>
- <if test="data.model != null and data.model!=''">
- model,
- </if>
- <if test="data.version != null and data.version!=''">
- version,
- </if>
- <if test="data.ble != null and data.ble!=''">
- ble,
- </if>
- <if test="data.SIM != null and data.SIM!=''">
- SIM,
- </if>
- <if test="data.isBind != null and data.isBind!=''">
- isBind,
- </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 and data.deviceId!=''">
- #{data.deviceId},
- </if>
- <if test="data.model != null and data.model!=''">
- #{data.model},
- </if>
- <if test="data.version != null and data.version!=''">
- #{data.version},
- </if>
- <if test="data.ble != null and data.ble!=''">
- #{data.ble},
- </if>
- <if test="data.SIM != null and data.SIM!=''">
- #{data.SIM},
- </if>
- <if test="data.isBind != null and data.isBind!=''">
- #{data.isBind},
- </if>
- <if test="data.createTime != null">
- #{data.createTime},
- </if>
- </trim>
- </update>
- <update id="upadate">
- update watch_device_data
- <trim prefix="SET" suffixOverrides=",">
- <if test="data.model != null and data.model !=''">model = #{data.model},</if>
- <if test="data.version != null and data.version !=''">version = #{data.version},</if>
- <if test="data.ble != null and data.ble !=''">ble = #{data.ble},</if>
- <if test="data.sim != null and data.sim !=''">SIM = #{data.sim},</if>
- <if test="data.isBind != null">isBind = #{data.isBind},</if>
- </trim>
- where device_id = #{data.deviceId}
- </update>
- <delete id="deleteByDeviceId">
- ALTER TABLE watch_device_data DELETE WHERE device_id = #{deviceId}
- </delete>
- <update id="updateByDeviceId">
- ALTER TABLE watch.watch_device_data UPDATE
- <trim prefix="" suffixOverrides=",">
- <if test="data.model != null and data.model !=''">model = #{data.model},</if>
- <if test="data.version != null and data.version !=''">version = #{data.version},</if>
- <if test="data.ble != null and data.ble !=''">ble = #{data.ble},</if>
- <if test="data.sim != null and data.sim !=''">SIM = #{data.sim},</if>
- <if test="data.isBind != null">isBind = #{data.isBind},</if>
- </trim>
- WHERE device_id = #{data.deviceId}
- </update>
- <select id="getByDeviceId" resultMap="BaseResultMap">
- select id,device_id,model,
- version,ble,SIM,isBind,create_time from watch_device_data where device_id = #{deviceId}
- </select>
- <select id="getListByDeviceId" resultMap="BaseResultMap">
- select id,device_id,model,
- version,ble,SIM,isBind,create_time from watch_device_data where device_id in #{deviceIds}
- </select>
- <select id="existsByDeviceId" resultType="java.lang.Integer">
- SELECT COUNT(1)
- FROM watch_device_data
- WHERE device_id = #{deviceId}
- </select>
- </mapper>
|