<?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.mysql.KwsAlarmInfoMapper">
  <resultMap id="BaseResultMap" type="com.sckw.slope.detection.model.dos.mysql.KwsAlarmInfo">
    <!--@mbg.generated-->
    <!--@Table kws_alarm_info-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="mountain_id" jdbcType="VARCHAR" property="mountainId" />
    <result column="company_id" jdbcType="VARCHAR" property="companyId" />
    <result column="level" jdbcType="INTEGER" property="level" />
    <result column="type" jdbcType="INTEGER" property="type" />
    <result column="value_desc" jdbcType="VARCHAR" property="valueDesc" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="del_flag" jdbcType="TINYINT" property="delFlag" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, mountain_id, company_id, `level`, `type`, value_desc, create_time, update_time, alias,
    del_flag
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
    <include refid="Base_Column_List" />
    from kws_alarm_info
    where id = #{id,jdbcType=BIGINT}
  </select>

  <select id="selectByDeviceParam" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from kws_alarm_info
    where del_flag=0
    order by level
  </select>

  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from kws_alarm_info
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsAlarmInfo">
    <!--@mbg.generated-->
    insert into kws_alarm_info (id, mountain_id, company_id, 
      `level`, `type`, value_desc, 
      create_time, update_time, del_flag,alias
      )
    values (#{id,jdbcType=BIGINT}, #{mountainId,jdbcType=VARCHAR}, #{companyId,jdbcType=VARCHAR}, 
      #{level,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{valueDesc,jdbcType=VARCHAR}, 
      #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=TINYINT}, #{alias,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsAlarmInfo">
    <!--@mbg.generated-->
    insert into kws_alarm_info
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="mountainId != null">
        mountain_id,
      </if>
      <if test="companyId != null">
        company_id,
      </if>
      <if test="level != null">
        `level`,
      </if>
      <if test="type != null">
        `type`,
      </if>
      <if test="valueDesc != null">
        value_desc,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="delFlag != null">
        del_flag,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="mountainId != null">
        #{mountainId,jdbcType=VARCHAR},
      </if>
      <if test="companyId != null">
        #{companyId,jdbcType=VARCHAR},
      </if>
      <if test="level != null">
        #{level,jdbcType=INTEGER},
      </if>
      <if test="type != null">
        #{type,jdbcType=INTEGER},
      </if>
      <if test="valueDesc != null">
        #{valueDesc,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="delFlag != null">
        #{delFlag,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsAlarmInfo">
    <!--@mbg.generated-->
    update kws_alarm_info
    <set>
      <if test="mountainId != null">
        mountain_id = #{mountainId,jdbcType=VARCHAR},
      </if>
      <if test="companyId != null">
        company_id = #{companyId,jdbcType=VARCHAR},
      </if>
      <if test="level != null">
        `level` = #{level,jdbcType=INTEGER},
      </if>
      <if test="type != null">
        `type` = #{type,jdbcType=INTEGER},
      </if>
      <if test="valueDesc != null">
        value_desc = #{valueDesc,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="delFlag != null">
        del_flag = #{delFlag,jdbcType=TINYINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsAlarmInfo">
    <!--@mbg.generated-->
    update kws_alarm_info
    set mountain_id = #{mountainId,jdbcType=VARCHAR},
      company_id = #{companyId,jdbcType=VARCHAR},
      `level` = #{level,jdbcType=INTEGER},
      `type` = #{type,jdbcType=INTEGER},
      value_desc = #{valueDesc,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      del_flag = #{delFlag,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>