<?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.sckw.slope.detection.dao.tdengine.DeviceMapper">
  <resultMap id="BaseResultMap" type="com.sckw.slope.detection.model.dos.tdengine.Device">
    <!--@mbg.generated-->
    <!--@Table device-->
    <id column="ts" jdbcType="TIMESTAMP" property="ts" />
    <result column="guid" jdbcType="VARCHAR" property="guid" />
    <result column="tslver" jdbcType="VARCHAR" property="tslver" />
    <result column="key" jdbcType="VARCHAR" property="key" />
    <result column="cvalue" jdbcType="VARCHAR" property="cvalue" />
    <result column="json_text" jdbcType="VARCHAR" property="jsonText" />
    <result column="sn" jdbcType="VARCHAR" property="sn" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    ts, guid, tslver, "key", cvalue, json_text, sn
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.util.Date" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
    <include refid="Base_Column_List" />
    from device
    where ts = #{ts,jdbcType=TIMESTAMP}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.util.Date">
    <!--@mbg.generated-->
    delete from device
    where ts = #{ts,jdbcType=TIMESTAMP}
  </delete>
  <insert id="insert" parameterType="com.sckw.slope.detection.model.dos.tdengine.Device">
    <!--@mbg.generated-->
    insert into device (ts, guid, tslver, 
      "key", cvalue, json_text, 
      sn)
    values (#{ts,jdbcType=TIMESTAMP}, #{guid,jdbcType=VARCHAR}, #{tslver,jdbcType=VARCHAR}, 
      #{key,jdbcType=VARCHAR}, #{cvalue,jdbcType=VARCHAR}, #{jsonText,jdbcType=VARCHAR}, 
      #{sn,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.tdengine.Device">
    <!--@mbg.generated-->
    insert into device
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="ts != null">
        ts,
      </if>
      <if test="guid != null">
        guid,
      </if>
      <if test="tslver != null">
        tslver,
      </if>
      <if test="key != null">
        "key",
      </if>
      <if test="cvalue != null">
        cvalue,
      </if>
      <if test="jsonText != null">
        json_text,
      </if>
      <if test="sn != null">
        sn,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="ts != null">
        #{ts,jdbcType=TIMESTAMP},
      </if>
      <if test="guid != null">
        #{guid,jdbcType=VARCHAR},
      </if>
      <if test="tslver != null">
        #{tslver,jdbcType=VARCHAR},
      </if>
      <if test="key != null">
        #{key,jdbcType=VARCHAR},
      </if>
      <if test="cvalue != null">
        #{cvalue,jdbcType=VARCHAR},
      </if>
      <if test="jsonText != null">
        #{jsonText,jdbcType=VARCHAR},
      </if>
      <if test="sn != null">
        #{sn,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.sckw.slope.detection.model.dos.tdengine.Device">
    <!--@mbg.generated-->
    update device
    <set>
      <if test="guid != null">
        guid = #{guid,jdbcType=VARCHAR},
      </if>
      <if test="tslver != null">
        tslver = #{tslver,jdbcType=VARCHAR},
      </if>
      <if test="key != null">
        "key" = #{key,jdbcType=VARCHAR},
      </if>
      <if test="cvalue != null">
        cvalue = #{cvalue,jdbcType=VARCHAR},
      </if>
      <if test="jsonText != null">
        json_text = #{jsonText,jdbcType=VARCHAR},
      </if>
      <if test="sn != null">
        sn = #{sn,jdbcType=VARCHAR},
      </if>
    </set>
    where ts = #{ts,jdbcType=TIMESTAMP}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.sckw.slope.detection.model.dos.tdengine.Device">
    <!--@mbg.generated-->
    update device
    set guid = #{guid,jdbcType=VARCHAR},
      tslver = #{tslver,jdbcType=VARCHAR},
      "key" = #{key,jdbcType=VARCHAR},
      cvalue = #{cvalue,jdbcType=VARCHAR},
      json_text = #{jsonText,jdbcType=VARCHAR},
      sn = #{sn,jdbcType=VARCHAR}
    where ts = #{ts,jdbcType=TIMESTAMP}
  </update>
</mapper>