<?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.TTestdataLayerMapper" >
  <resultMap id="BaseResultMap" type="com.chinaitop.depot.intelligent.grainsituation.model.TTestdataLayer" >
    <result column="id" property="id" jdbcType="VARCHAR" />
    <result column="org_id" property="orgId" jdbcType="VARCHAR" />
    <result column="lq_id" property="lqId" jdbcType="VARCHAR" />
    <result column="lHouse" property="lhouse" jdbcType="VARCHAR" />
    <result column="lTime" property="ltime" jdbcType="TIMESTAMP" />
    <result column="layerNumber" property="layernumber" jdbcType="INTEGER" />
    <result column="lZ" property="lz" jdbcType="VARCHAR" />
    <result column="lMax" property="lmax" jdbcType="DECIMAL" />
    <result column="lMin" property="lmin" jdbcType="DECIMAL" />
    <result column="lAvg" property="lavg" jdbcType="DECIMAL" />
    <result column="data_source" property="dataSource" 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, lq_id, lHouse, lTime, layerNumber, lZ, lMax, lMin, lAvg, data_source
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TTestdataLayerExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from t_testdata_layer
    <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.TTestdataLayerExample" >
    delete from t_testdata_layer
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TTestdataLayer" >
    insert into t_testdata_layer (id, org_id, lq_id, 
      lHouse, lTime, layerNumber, 
      lZ, lMax, lMin, lAvg, 
      data_source)
    values (#{id,jdbcType=VARCHAR}, #{orgId,jdbcType=VARCHAR}, #{lqId,jdbcType=VARCHAR}, 
      #{lhouse,jdbcType=VARCHAR}, #{ltime,jdbcType=TIMESTAMP}, #{layernumber,jdbcType=INTEGER}, 
      #{lz,jdbcType=VARCHAR}, #{lmax,jdbcType=DECIMAL}, #{lmin,jdbcType=DECIMAL}, #{lavg,jdbcType=DECIMAL}, 
      #{dataSource,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TTestdataLayer" >
    insert into t_testdata_layer
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="orgId != null" >
        org_id,
      </if>
      <if test="lqId != null" >
        lq_id,
      </if>
      <if test="lhouse != null" >
        lHouse,
      </if>
      <if test="ltime != null" >
        lTime,
      </if>
      <if test="layernumber != null" >
        layerNumber,
      </if>
      <if test="lz != null" >
        lZ,
      </if>
      <if test="lmax != null" >
        lMax,
      </if>
      <if test="lmin != null" >
        lMin,
      </if>
      <if test="lavg != null" >
        lAvg,
      </if>
      <if test="dataSource != null" >
        data_source,
      </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="lqId != null" >
        #{lqId,jdbcType=VARCHAR},
      </if>
      <if test="lhouse != null" >
        #{lhouse,jdbcType=VARCHAR},
      </if>
      <if test="ltime != null" >
        #{ltime,jdbcType=TIMESTAMP},
      </if>
      <if test="layernumber != null" >
        #{layernumber,jdbcType=INTEGER},
      </if>
      <if test="lz != null" >
        #{lz,jdbcType=VARCHAR},
      </if>
      <if test="lmax != null" >
        #{lmax,jdbcType=DECIMAL},
      </if>
      <if test="lmin != null" >
        #{lmin,jdbcType=DECIMAL},
      </if>
      <if test="lavg != null" >
        #{lavg,jdbcType=DECIMAL},
      </if>
      <if test="dataSource != null" >
        #{dataSource,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TTestdataLayerExample" resultType="java.lang.Integer" >
    select count(*) from t_testdata_layer
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update t_testdata_layer
    <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.lqId != null" >
        lq_id = #{record.lqId,jdbcType=VARCHAR},
      </if>
      <if test="record.lhouse != null" >
        lHouse = #{record.lhouse,jdbcType=VARCHAR},
      </if>
      <if test="record.ltime != null" >
        lTime = #{record.ltime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.layernumber != null" >
        layerNumber = #{record.layernumber,jdbcType=INTEGER},
      </if>
      <if test="record.lz != null" >
        lZ = #{record.lz,jdbcType=VARCHAR},
      </if>
      <if test="record.lmax != null" >
        lMax = #{record.lmax,jdbcType=DECIMAL},
      </if>
      <if test="record.lmin != null" >
        lMin = #{record.lmin,jdbcType=DECIMAL},
      </if>
      <if test="record.lavg != null" >
        lAvg = #{record.lavg,jdbcType=DECIMAL},
      </if>
      <if test="record.dataSource != null" >
        data_source = #{record.dataSource,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update t_testdata_layer
    set id = #{record.id,jdbcType=VARCHAR},
      org_id = #{record.orgId,jdbcType=VARCHAR},
      lq_id = #{record.lqId,jdbcType=VARCHAR},
      lHouse = #{record.lhouse,jdbcType=VARCHAR},
      lTime = #{record.ltime,jdbcType=TIMESTAMP},
      layerNumber = #{record.layernumber,jdbcType=INTEGER},
      lZ = #{record.lz,jdbcType=VARCHAR},
      lMax = #{record.lmax,jdbcType=DECIMAL},
      lMin = #{record.lmin,jdbcType=DECIMAL},
      lAvg = #{record.lavg,jdbcType=DECIMAL},
      data_source = #{record.dataSource,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_testdata_layer (id, org_id, lq_id,
     lHouse, lTime, layerNumber,
     lZ, lMax, lMin, lAvg,
     data_source)
     values
     <foreach collection="list" item="ly" index="index" separator=",">
       (#{ly.id,jdbcType=VARCHAR}, #{ly.orgId,jdbcType=VARCHAR}, #{ly.lqId,jdbcType=VARCHAR},
       #{ly.lhouse,jdbcType=VARCHAR}, #{ly.ltime,jdbcType=TIMESTAMP}, #{ly.layernumber,jdbcType=INTEGER},
       #{ly.lz,jdbcType=VARCHAR}, #{ly.lmax,jdbcType=DECIMAL}, #{ly.lmin,jdbcType=DECIMAL}, #{ly.lavg,jdbcType=DECIMAL},
       #{ly.dataSource,jdbcType=VARCHAR})
     </foreach>
  </insert>
</mapper>