<?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.TDcsdataMapper" >
  <resultMap id="BaseResultMap" type="com.chinaitop.depot.intelligent.grainsituation.model.TDcsdata" >
    <result column="id" property="id" jdbcType="VARCHAR" />
    <result column="org_id" property="orgId" jdbcType="VARCHAR" />
    <result column="v_dcs_code" property="vDcsCode" jdbcType="VARCHAR" />
    <result column="i_tdh" property="iTdh" jdbcType="INTEGER" />
    <result column="i_value" property="iValue" jdbcType="DECIMAL" />
    <result column="v_dev_kind_code" property="vDevKindCode" jdbcType="VARCHAR" />
    <result column="v_update_time" property="vUpdateTime" jdbcType="TIMESTAMP" />
    <result column="data_source" property="dataSource" jdbcType="VARCHAR" />
    <result column="v_remark" property="vRemark" 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_dcs_code, i_tdh, i_value, v_dev_kind_code, v_update_time, data_source, 
    v_remark
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TDcsdataExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from t_dcsdata
    <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.TDcsdataExample" >
    delete from t_dcsdata
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TDcsdata" >
    insert into t_dcsdata (id, org_id, v_dcs_code, 
      i_tdh, i_value, v_dev_kind_code, 
      v_update_time, data_source, v_remark
      )
    values (#{id,jdbcType=VARCHAR}, #{orgId,jdbcType=VARCHAR}, #{vDcsCode,jdbcType=VARCHAR}, 
      #{iTdh,jdbcType=INTEGER}, #{iValue,jdbcType=DECIMAL}, #{vDevKindCode,jdbcType=VARCHAR}, 
      #{vUpdateTime,jdbcType=TIMESTAMP}, #{dataSource,jdbcType=VARCHAR}, #{vRemark,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TDcsdata" >
    insert into t_dcsdata
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="orgId != null" >
        org_id,
      </if>
      <if test="vDcsCode != null" >
        v_dcs_code,
      </if>
      <if test="iTdh != null" >
        i_tdh,
      </if>
      <if test="iValue != null" >
        i_value,
      </if>
      <if test="vDevKindCode != null" >
        v_dev_kind_code,
      </if>
      <if test="vUpdateTime != null" >
        v_update_time,
      </if>
      <if test="dataSource != null" >
        data_source,
      </if>
      <if test="vRemark != null" >
        v_remark,
      </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="vDcsCode != null" >
        #{vDcsCode,jdbcType=VARCHAR},
      </if>
      <if test="iTdh != null" >
        #{iTdh,jdbcType=INTEGER},
      </if>
      <if test="iValue != null" >
        #{iValue,jdbcType=DECIMAL},
      </if>
      <if test="vDevKindCode != null" >
        #{vDevKindCode,jdbcType=VARCHAR},
      </if>
      <if test="vUpdateTime != null" >
        #{vUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="dataSource != null" >
        #{dataSource,jdbcType=VARCHAR},
      </if>
      <if test="vRemark != null" >
        #{vRemark,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TDcsdataExample" resultType="java.lang.Integer" >
    select count(*) from t_dcsdata
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update t_dcsdata
    <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.vDcsCode != null" >
        v_dcs_code = #{record.vDcsCode,jdbcType=VARCHAR},
      </if>
      <if test="record.iTdh != null" >
        i_tdh = #{record.iTdh,jdbcType=INTEGER},
      </if>
      <if test="record.iValue != null" >
        i_value = #{record.iValue,jdbcType=DECIMAL},
      </if>
      <if test="record.vDevKindCode != null" >
        v_dev_kind_code = #{record.vDevKindCode,jdbcType=VARCHAR},
      </if>
      <if test="record.vUpdateTime != null" >
        v_update_time = #{record.vUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.dataSource != null" >
        data_source = #{record.dataSource,jdbcType=VARCHAR},
      </if>
      <if test="record.vRemark != null" >
        v_remark = #{record.vRemark,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update t_dcsdata
    set id = #{record.id,jdbcType=VARCHAR},
      org_id = #{record.orgId,jdbcType=VARCHAR},
      v_dcs_code = #{record.vDcsCode,jdbcType=VARCHAR},
      i_tdh = #{record.iTdh,jdbcType=INTEGER},
      i_value = #{record.iValue,jdbcType=DECIMAL},
      v_dev_kind_code = #{record.vDevKindCode,jdbcType=VARCHAR},
      v_update_time = #{record.vUpdateTime,jdbcType=TIMESTAMP},
      data_source = #{record.dataSource,jdbcType=VARCHAR},
      v_remark = #{record.vRemark,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_dcsdata (id, org_id, v_dcs_code,
    i_tdh, i_value, v_dev_kind_code,
    v_update_time, data_source, v_remark
    )
    values
    <foreach collection="list" item="qt" index="index" separator=",">
      (#{qt.id,jdbcType=VARCHAR}, #{qt.orgId,jdbcType=VARCHAR}, #{qt.vDcsCode,jdbcType=VARCHAR},
      #{qt.iTdh,jdbcType=INTEGER}, #{qt.iValue,jdbcType=DECIMAL}, #{qt.vDevKindCode,jdbcType=VARCHAR},
      #{qt.vUpdateTime,jdbcType=TIMESTAMP}, #{qt.dataSource,jdbcType=VARCHAR}, #{qt.vRemark,jdbcType=VARCHAR}
      )
    </foreach>
  </insert>
</mapper>