<?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.grainsituation.mapper.TWarningThresholdHistoryMapper" >
  <resultMap id="BaseResultMap" type="com.chinaitop.depot.intelligent.grainsituation.model.TWarningThresholdHistory" >
    <result 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_threshold" property="wThreshold" jdbcType="DECIMAL" />
    <result column="threshold" property="threshold" jdbcType="DECIMAL" />
    <result column="w_state" property="wState" jdbcType="INTEGER" />
    <result column="w_time" property="wTime" jdbcType="TIMESTAMP" />
    <result column="w_update_time" property="wUpdateTime" jdbcType="TIMESTAMP" />
    <result column="data_source" property="dataSource" jdbcType="VARCHAR" />
    <result column="w_remark" property="wRemark" jdbcType="VARCHAR" />
    <result column="updatetime" property="updatetime" jdbcType="TIMESTAMP" />
    <result column="is_send" property="isSend" jdbcType="VARCHAR" />
    <result column="w_mode" property="wMode" jdbcType="VARCHAR" />
    <result column="w_warning" property="wWarning" jdbcType="VARCHAR" />
  </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_threshold, threshold, w_state, w_time, 
    w_update_time, data_source, w_remark, updatetime, is_send, w_mode, w_warning
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TWarningThresholdHistoryExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from t_warning_threshold_history
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <delete id="deleteByExample" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TWarningThresholdHistoryExample" >
    delete from t_warning_threshold_history
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TWarningThresholdHistory" >
    insert into t_warning_threshold_history (id, org_id, v_cf_code, 
      w_module, w_name, w_threshold, 
      threshold, w_state, w_time, 
      w_update_time, data_source, w_remark, 
      updatetime, is_send, w_mode, 
      w_warning)
    values (#{id,jdbcType=VARCHAR}, #{orgId,jdbcType=VARCHAR}, #{vCfCode,jdbcType=VARCHAR}, 
      #{wModule,jdbcType=VARCHAR}, #{wName,jdbcType=VARCHAR}, #{wThreshold,jdbcType=DECIMAL}, 
      #{threshold,jdbcType=DECIMAL}, #{wState,jdbcType=INTEGER}, #{wTime,jdbcType=TIMESTAMP}, 
      #{wUpdateTime,jdbcType=TIMESTAMP}, #{dataSource,jdbcType=VARCHAR}, #{wRemark,jdbcType=VARCHAR}, 
      #{updatetime,jdbcType=TIMESTAMP}, #{isSend,jdbcType=VARCHAR}, #{wMode,jdbcType=VARCHAR}, 
      #{wWarning,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TWarningThresholdHistory" >
    insert into t_warning_threshold_history
    <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="wThreshold != null" >
        w_threshold,
      </if>
      <if test="threshold != null" >
        threshold,
      </if>
      <if test="wState != null" >
        w_state,
      </if>
      <if test="wTime != null" >
        w_time,
      </if>
      <if test="wUpdateTime != null" >
        w_update_time,
      </if>
      <if test="dataSource != null" >
        data_source,
      </if>
      <if test="wRemark != null" >
        w_remark,
      </if>
      <if test="updatetime != null" >
        updatetime,
      </if>
      <if test="isSend != null" >
        is_send,
      </if>
      <if test="wMode != null" >
        w_mode,
      </if>
      <if test="wWarning != null" >
        w_warning,
      </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="wThreshold != null" >
        #{wThreshold,jdbcType=DECIMAL},
      </if>
      <if test="threshold != null" >
        #{threshold,jdbcType=DECIMAL},
      </if>
      <if test="wState != null" >
        #{wState,jdbcType=INTEGER},
      </if>
      <if test="wTime != null" >
        #{wTime,jdbcType=TIMESTAMP},
      </if>
      <if test="wUpdateTime != null" >
        #{wUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="dataSource != null" >
        #{dataSource,jdbcType=VARCHAR},
      </if>
      <if test="wRemark != null" >
        #{wRemark,jdbcType=VARCHAR},
      </if>
      <if test="updatetime != null" >
        #{updatetime,jdbcType=TIMESTAMP},
      </if>
      <if test="isSend != null" >
        #{isSend,jdbcType=VARCHAR},
      </if>
      <if test="wMode != null" >
        #{wMode,jdbcType=VARCHAR},
      </if>
      <if test="wWarning != null" >
        #{wWarning,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TWarningThresholdHistoryExample" resultType="java.lang.Integer" >
    select count(*) from t_warning_threshold_history
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update t_warning_threshold_history
    <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.wThreshold != null" >
        w_threshold = #{record.wThreshold,jdbcType=DECIMAL},
      </if>
      <if test="record.threshold != null" >
        threshold = #{record.threshold,jdbcType=DECIMAL},
      </if>
      <if test="record.wState != null" >
        w_state = #{record.wState,jdbcType=INTEGER},
      </if>
      <if test="record.wTime != null" >
        w_time = #{record.wTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.wUpdateTime != null" >
        w_update_time = #{record.wUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.dataSource != null" >
        data_source = #{record.dataSource,jdbcType=VARCHAR},
      </if>
      <if test="record.wRemark != null" >
        w_remark = #{record.wRemark,jdbcType=VARCHAR},
      </if>
      <if test="record.updatetime != null" >
        updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.isSend != null" >
        is_send = #{record.isSend,jdbcType=VARCHAR},
      </if>
      <if test="record.wMode != null" >
        w_mode = #{record.wMode,jdbcType=VARCHAR},
      </if>
      <if test="record.wWarning != null" >
        w_warning = #{record.wWarning,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update t_warning_threshold_history
    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_threshold = #{record.wThreshold,jdbcType=DECIMAL},
      threshold = #{record.threshold,jdbcType=DECIMAL},
      w_state = #{record.wState,jdbcType=INTEGER},
      w_time = #{record.wTime,jdbcType=TIMESTAMP},
      w_update_time = #{record.wUpdateTime,jdbcType=TIMESTAMP},
      data_source = #{record.dataSource,jdbcType=VARCHAR},
      w_remark = #{record.wRemark,jdbcType=VARCHAR},
      updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
      is_send = #{record.isSend,jdbcType=VARCHAR},
      w_mode = #{record.wMode,jdbcType=VARCHAR},
      w_warning = #{record.wWarning,jdbcType=VARCHAR}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>

  <insert id="insertBatch" parameterType="java.util.List">
    insert into t_warning_threshold_history (id, org_id, v_cf_code,
    w_module, w_name, w_threshold,
    threshold, w_state, w_time,
    w_update_time, data_source, w_remark,
    updatetime, is_send, w_mode,
    w_warning)
    values
    <foreach collection="list" item="th" index="index" separator=",">
      (#{th.id,jdbcType=VARCHAR}, #{th.orgId,jdbcType=VARCHAR}, #{th.vCfCode,jdbcType=VARCHAR},
      #{th.wModule,jdbcType=VARCHAR}, #{th.wName,jdbcType=VARCHAR}, #{th.wThreshold,jdbcType=DECIMAL},
      #{th.threshold,jdbcType=DECIMAL}, #{th.wState,jdbcType=INTEGER}, #{th.wTime,jdbcType=TIMESTAMP},
      #{th.wUpdateTime,jdbcType=TIMESTAMP}, #{th.dataSource,jdbcType=VARCHAR}, #{th.wRemark,jdbcType=VARCHAR},
      #{th.updatetime,jdbcType=TIMESTAMP}, #{th.isSend,jdbcType=VARCHAR}, #{th.wMode,jdbcType=VARCHAR},
      #{th.wWarning,jdbcType=VARCHAR})
    </foreach>
  </insert>
</mapper>