<?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.KwsDictMapper">
  <resultMap id="BaseResultMap" type="com.sckw.slope.detection.model.dos.mysql.KwsDict">
    <!--@mbg.generated-->
    <!--@Table kws_dict-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="type_code" jdbcType="VARCHAR" property="typeCode" />
    <result column="parent_id" jdbcType="BIGINT" property="parentId" />
    <result column="value" jdbcType="VARCHAR" property="value" />
    <result column="label" jdbcType="VARCHAR" property="label" />
    <result column="desc" jdbcType="VARCHAR" property="desc" />
    <result column="status" jdbcType="TINYINT" property="status" />
    <result column="create_by" jdbcType="BIGINT" property="createBy" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_by" jdbcType="BIGINT" property="updateBy" />
    <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, type_code, parent_id, `value`, `label`, `desc`, `status`, create_by, create_time, 
    update_by, update_time, del_flag
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
    <include refid="Base_Column_List" />
    from kws_dict
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from kws_dict
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsDict">
    <!--@mbg.generated-->
    insert into kws_dict (id, type_code, parent_id, 
      `value`, `label`, `desc`, 
      `status`, create_by, create_time, 
      update_by, update_time, del_flag
      )
    values (#{id,jdbcType=BIGINT}, #{typeCode,jdbcType=VARCHAR}, #{parentId,jdbcType=BIGINT}, 
      #{value,jdbcType=VARCHAR}, #{label,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR}, 
      #{status,jdbcType=TINYINT}, #{createBy,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, 
      #{updateBy,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=TINYINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsDict">
    <!--@mbg.generated-->
    insert into kws_dict
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="typeCode != null">
        type_code,
      </if>
      <if test="parentId != null">
        parent_id,
      </if>
      <if test="value != null">
        `value`,
      </if>
      <if test="label != null">
        `label`,
      </if>
      <if test="desc != null">
        `desc`,
      </if>
      <if test="status != null">
        `status`,
      </if>
      <if test="createBy != null">
        create_by,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateBy != null">
        update_by,
      </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="typeCode != null">
        #{typeCode,jdbcType=VARCHAR},
      </if>
      <if test="parentId != null">
        #{parentId,jdbcType=BIGINT},
      </if>
      <if test="value != null">
        #{value,jdbcType=VARCHAR},
      </if>
      <if test="label != null">
        #{label,jdbcType=VARCHAR},
      </if>
      <if test="desc != null">
        #{desc,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=TINYINT},
      </if>
      <if test="createBy != null">
        #{createBy,jdbcType=BIGINT},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateBy != null">
        #{updateBy,jdbcType=BIGINT},
      </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.KwsDict">
    <!--@mbg.generated-->
    update kws_dict
    <set>
      <if test="typeCode != null">
        type_code = #{typeCode,jdbcType=VARCHAR},
      </if>
      <if test="parentId != null">
        parent_id = #{parentId,jdbcType=BIGINT},
      </if>
      <if test="value != null">
        `value` = #{value,jdbcType=VARCHAR},
      </if>
      <if test="label != null">
        `label` = #{label,jdbcType=VARCHAR},
      </if>
      <if test="desc != null">
        `desc` = #{desc,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        `status` = #{status,jdbcType=TINYINT},
      </if>
      <if test="createBy != null">
        create_by = #{createBy,jdbcType=BIGINT},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateBy != null">
        update_by = #{updateBy,jdbcType=BIGINT},
      </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.KwsDict">
    <!--@mbg.generated-->
    update kws_dict
    set type_code = #{typeCode,jdbcType=VARCHAR},
      parent_id = #{parentId,jdbcType=BIGINT},
      `value` = #{value,jdbcType=VARCHAR},
      `label` = #{label,jdbcType=VARCHAR},
      `desc` = #{desc,jdbcType=VARCHAR},
      `status` = #{status,jdbcType=TINYINT},
      create_by = #{createBy,jdbcType=BIGINT},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_by = #{updateBy,jdbcType=BIGINT},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      del_flag = #{delFlag,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  </update>

  <select id="selectListAll" resultType="com.sckw.slope.detection.model.vo.QueryDictTypePageReqVo">
      select id,
             value,
             label,
             type_code as typeCode
      from kws_dict
      where del_flag = 0
      <if test="reqVo.label != null and reqVo.label != ''">
          and label = #{reqVo.label}
      </if>
      <if test="reqVo.typeCode != null and reqVo.typeCode != ''">
          and type_code = #{reqVo.typeCode}
      </if>
      <if test="reqVo.value != null and reqVo.value != ''">
          and value = #{reqVo.value,jdbcType=VARCHAR}
      </if>
  </select>
</mapper>