<?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.chinaitop.depot.intelligent.basicdata.mapper.TWarningThresholdMapper" >
  <resultMap id="BaseResultMap" type="com.chinaitop.depot.intelligent.basicdata.model.TWarningThreshold" >
    <id column="id" property="id" jdbcType="VARCHAR" />
    <result column="org_id" property="orgId" jdbcType="VARCHAR" />
    <result column="v_cf_code" property="vCfCode" jdbcType="VARCHAR" />
    <result column="w_module" property="wModule" jdbcType="VARCHAR" />
    <result column="w_name" property="wName" jdbcType="VARCHAR" />
    <result column="w_state" property="wState" jdbcType="INTEGER" />
    <result column="threshold" property="threshold" jdbcType="DECIMAL" />
    <result column="w_update_person" property="wUpdatePerson" jdbcType="VARCHAR" />
    <result column="w_update_time" property="wUpdateTime" jdbcType="TIMESTAMP" />
    <result column="del_flag" property="delFlag" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Example_Where_Clause" >
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <foreach collection="criteria.criteria" item="criterion" >
              <choose >
                <when test="criterion.noValue" >
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue" >
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue" >
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue" >
                  and ${criterion.condition}
                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause" >
    <where >
      <foreach collection="example.oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <foreach collection="criteria.criteria" item="criterion" >
              <choose >
                <when test="criterion.noValue" >
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue" >
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue" >
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue" >
                  and ${criterion.condition}
                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List" >
    id, org_id, v_cf_code, w_module, w_name, w_state, threshold, w_update_person, w_update_time, 
    del_flag
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.intelligent.basicdata.model.TWarningThresholdExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from t_warning_threshold
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select 
    <include refid="Base_Column_List" />
    from t_warning_threshold
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    delete from t_warning_threshold
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.chinaitop.depot.intelligent.basicdata.model.TWarningThresholdExample" >
    delete from t_warning_threshold
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.chinaitop.depot.intelligent.basicdata.model.TWarningThreshold" >
    insert into t_warning_threshold (id, org_id, v_cf_code, 
      w_module, w_name, w_state, 
      threshold, w_update_person, w_update_time, 
      del_flag)
    values (#{id,jdbcType=VARCHAR}, #{orgId,jdbcType=VARCHAR}, #{vCfCode,jdbcType=VARCHAR}, 
      #{wModule,jdbcType=VARCHAR}, #{wName,jdbcType=VARCHAR}, #{wState,jdbcType=INTEGER}, 
      #{threshold,jdbcType=DECIMAL}, #{wUpdatePerson,jdbcType=VARCHAR}, #{wUpdateTime,jdbcType=TIMESTAMP}, 
      #{delFlag,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.chinaitop.depot.intelligent.basicdata.model.TWarningThreshold" >
    insert into t_warning_threshold
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="orgId != null" >
        org_id,
      </if>
      <if test="vCfCode != null" >
        v_cf_code,
      </if>
      <if test="wModule != null" >
        w_module,
      </if>
      <if test="wName != null" >
        w_name,
      </if>
      <if test="wState != null" >
        w_state,
      </if>
      <if test="threshold != null" >
        threshold,
      </if>
      <if test="wUpdatePerson != null" >
        w_update_person,
      </if>
      <if test="wUpdateTime != null" >
        w_update_time,
      </if>
      <if test="delFlag != null" >
        del_flag,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="orgId != null" >
        #{orgId,jdbcType=VARCHAR},
      </if>
      <if test="vCfCode != null" >
        #{vCfCode,jdbcType=VARCHAR},
      </if>
      <if test="wModule != null" >
        #{wModule,jdbcType=VARCHAR},
      </if>
      <if test="wName != null" >
        #{wName,jdbcType=VARCHAR},
      </if>
      <if test="wState != null" >
        #{wState,jdbcType=INTEGER},
      </if>
      <if test="threshold != null" >
        #{threshold,jdbcType=DECIMAL},
      </if>
      <if test="wUpdatePerson != null" >
        #{wUpdatePerson,jdbcType=VARCHAR},
      </if>
      <if test="wUpdateTime != null" >
        #{wUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="delFlag != null" >
        #{delFlag,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.chinaitop.depot.intelligent.basicdata.model.TWarningThresholdExample" resultType="java.lang.Integer" >
    select count(*) from t_warning_threshold
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update t_warning_threshold
    <set >
      <if test="record.id != null" >
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.orgId != null" >
        org_id = #{record.orgId,jdbcType=VARCHAR},
      </if>
      <if test="record.vCfCode != null" >
        v_cf_code = #{record.vCfCode,jdbcType=VARCHAR},
      </if>
      <if test="record.wModule != null" >
        w_module = #{record.wModule,jdbcType=VARCHAR},
      </if>
      <if test="record.wName != null" >
        w_name = #{record.wName,jdbcType=VARCHAR},
      </if>
      <if test="record.wState != null" >
        w_state = #{record.wState,jdbcType=INTEGER},
      </if>
      <if test="record.threshold != null" >
        threshold = #{record.threshold,jdbcType=DECIMAL},
      </if>
      <if test="record.wUpdatePerson != null" >
        w_update_person = #{record.wUpdatePerson,jdbcType=VARCHAR},
      </if>
      <if test="record.wUpdateTime != null" >
        w_update_time = #{record.wUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.delFlag != null" >
        del_flag = #{record.delFlag,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update t_warning_threshold
    set id = #{record.id,jdbcType=VARCHAR},
      org_id = #{record.orgId,jdbcType=VARCHAR},
      v_cf_code = #{record.vCfCode,jdbcType=VARCHAR},
      w_module = #{record.wModule,jdbcType=VARCHAR},
      w_name = #{record.wName,jdbcType=VARCHAR},
      w_state = #{record.wState,jdbcType=INTEGER},
      threshold = #{record.threshold,jdbcType=DECIMAL},
      w_update_person = #{record.wUpdatePerson,jdbcType=VARCHAR},
      w_update_time = #{record.wUpdateTime,jdbcType=TIMESTAMP},
      del_flag = #{record.delFlag,jdbcType=INTEGER}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.chinaitop.depot.intelligent.basicdata.model.TWarningThreshold" >
    update t_warning_threshold
    <set >
      <if test="orgId != null" >
        org_id = #{orgId,jdbcType=VARCHAR},
      </if>
      <if test="vCfCode != null" >
        v_cf_code = #{vCfCode,jdbcType=VARCHAR},
      </if>
      <if test="wModule != null" >
        w_module = #{wModule,jdbcType=VARCHAR},
      </if>
      <if test="wName != null" >
        w_name = #{wName,jdbcType=VARCHAR},
      </if>
      <if test="wState != null" >
        w_state = #{wState,jdbcType=INTEGER},
      </if>
      <if test="threshold != null" >
        threshold = #{threshold,jdbcType=DECIMAL},
      </if>
      <if test="wUpdatePerson != null" >
        w_update_person = #{wUpdatePerson,jdbcType=VARCHAR},
      </if>
      <if test="wUpdateTime != null" >
        w_update_time = #{wUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="delFlag != null" >
        del_flag = #{delFlag,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.chinaitop.depot.intelligent.basicdata.model.TWarningThreshold" >
    update t_warning_threshold
    set org_id = #{orgId,jdbcType=VARCHAR},
      v_cf_code = #{vCfCode,jdbcType=VARCHAR},
      w_module = #{wModule,jdbcType=VARCHAR},
      w_name = #{wName,jdbcType=VARCHAR},
      w_state = #{wState,jdbcType=INTEGER},
      threshold = #{threshold,jdbcType=DECIMAL},
      w_update_person = #{wUpdatePerson,jdbcType=VARCHAR},
      w_update_time = #{wUpdateTime,jdbcType=TIMESTAMP},
      del_flag = #{delFlag,jdbcType=INTEGER}
    where id = #{id,jdbcType=VARCHAR}
  </update>
  
  <update id="updateByMap" parameterType="map">
  	update t_warning_threshold 
  	 set del_flag = #{delFlag,jdbcType=INTEGER}
  	 where v_cf_code = #{vCfCode,jdbcType=VARCHAR}
  </update>
</mapper>