<?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.steerinfo.ems.ifmesemswatermonitor.mapper.IfMesEmsWatermonitorMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.ems.ifmesemswatermonitor.model.IfMesEmsWatermonitor">
    <id column="WTBH" jdbcType="VARCHAR" property="wtbh" />
    <result column="MATERIALNO" jdbcType="VARCHAR" property="materialno" />
    <result column="MATERIALNAME" jdbcType="VARCHAR" property="materialname" />
    <result column="ITEMCODE" jdbcType="VARCHAR" property="itemcode" />
    <result column="ITEM" jdbcType="VARCHAR" property="item" />
    <result column="TESTRESULT" jdbcType="VARCHAR" property="testresult" />
    <result column="ITEMJUDGERESULT" jdbcType="VARCHAR" property="itemjudgeresult" />
    <result column="JUDGERESULT" jdbcType="VARCHAR" property="judgeresult" />
    <result column="SAMPLETYPE" jdbcType="VARCHAR" property="sampletype" />
    <result column="INPUTTIME" jdbcType="VARCHAR" property="inputtime" />
    <result column="JUDGETIME" jdbcType="VARCHAR" property="judgetime" />
    <result column="RECORDER" jdbcType="VARCHAR" property="recorder" />
    <result column="SAMPLENO" jdbcType="VARCHAR" property="sampleno" />
    <result column="SAMPLEPERSON" jdbcType="VARCHAR" property="sampleperson" />
    <result column="SAMPLETIME" jdbcType="VARCHAR" property="sampletime" />
    <result column="SENDER" jdbcType="VARCHAR" property="sender" />
    <result column="SENDTIME" jdbcType="VARCHAR" property="sendtime" />
    <result column="MEMO" jdbcType="VARCHAR" property="memo" />
    <result column="MATERIALSOURCE" jdbcType="VARCHAR" property="materialsource" />
  </resultMap>

  <insert id="insert" parameterType="com.steerinfo.ems.ifmesemswatermonitor.model.IfMesEmsWatermonitor">
    insert into IF_MES_EMS_WATERMONITOR (WTBH, MATERIALNO, MATERIALNAME,
      ITEMCODE, ITEM, TESTRESULT, ITEMJUDGERESULT, JUDGERESULT, SAMPLETYPE,
      INPUTTIME, JUDGETIME, RECORDER, SAMPLENO, SAMPLEPERSON, SAMPLETIME,
      SENDER, SENDTIME, MEMO,  MATERIALSOURCE)
    values (#{wtbh,jdbcType=VARCHAR}, #{materialno,jdbcType=VARCHAR}, #{materialname,jdbcType=VARCHAR},
      #{itemcode,jdbcType=VARCHAR}, #{item,jdbcType=VARCHAR}, #{testresult,jdbcType=VARCHAR},
      #{itemjudgeresult,jdbcType=VARCHAR}, #{judgeresult,jdbcType=VARCHAR}, #{sampletype,jdbcType=VARCHAR},
      #{inputtime,jdbcType=VARCHAR}, #{judgetime,jdbcType=VARCHAR}, #{recorder,jdbcType=VARCHAR},
      #{sampleno,jdbcType=VARCHAR}, #{sampleperson,jdbcType=VARCHAR}, #{sampletime,jdbcType=VARCHAR},
      #{sender,jdbcType=VARCHAR}, #{sendtime,jdbcType=VARCHAR}, #{memo,jdbcType=VARCHAR}, #{materialsource,jdbcType=VARCHAR})
  </insert>

  <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.ifmesemswatermonitor.model.IfMesEmsWatermonitor">
    update IF_MES_EMS_WATERMONITOR
    set WTBH = #{wtbh,jdbcType=VARCHAR},
      MATERIALNAME = #{materialname,jdbcType=VARCHAR},
      ITEM = #{item,jdbcType=VARCHAR},
      TESTRESULT = #{testresult,jdbcType=VARCHAR},
      ITEMJUDGERESULT = #{itemjudgeresult,jdbcType=VARCHAR},
      JUDGERESULT = #{judgeresult,jdbcType=VARCHAR},
      SAMPLETYPE = #{sampletype,jdbcType=VARCHAR},
      JUDGETIME = #{judgetime,jdbcType=VARCHAR},
      RECORDER = #{recorder,jdbcType=VARCHAR},
      SAMPLENO = #{sampleno,jdbcType=VARCHAR},
      SAMPLEPERSON = #{sampleperson,jdbcType=VARCHAR},
      SAMPLETIME = #{sampletime,jdbcType=VARCHAR},
      SENDER = #{sender,jdbcType=VARCHAR},
      SENDTIME = #{sendtime,jdbcType=VARCHAR},
      MEMO = #{memo,jdbcType=VARCHAR},
      MATERIALSOURCE = #{materialsource,jdbcType=VARCHAR}
    where INPUTTIME = #{inputtime,jdbcType=VARCHAR}
    and MATERIALNO = #{materialno,jdbcType=VARCHAR}
    and ITEMCODE = #{itemcode,jdbcType=VARCHAR}
  </update>

  <select id="getNewData" resultMap="BaseResultMap">
    SELECT t.WTBH, t.MATERIALNO, t.MATERIALNAME, t.ITEMCODE, t.ITEM, t2.TESTRESULT,
	t.ITEMJUDGERESULT, t.JUDGERESULT, t.SAMPLETYPE, t.INPUTTIME, t.JUDGETIME,
	t.RECORDER, t.SAMPLENO, t.SAMPLEPERSON, t.SAMPLETIME, t.SENDER,
	t.SENDTIME, t.MEMO, t.MATERIALSOURCE
    FROM
	IF_MES_EMS_WATERMONITOR t,
	(SELECT INPUTTIME, MATERIALNO, ITEMCODE, AVG( TESTRESULT ) AS TESTRESULT FROM IF_MES_EMS_WATERMONITOR GROUP BY INPUTTIME, MATERIALNO, ITEMCODE) t2
    WHERE t.INPUTTIME = t2.INPUTTIME
	    and t.MATERIALNO = t2.MATERIALNO
	    and t.ITEMCODE = t2.ITEMCODE
	    and SUBSTR( JUDGETIME, 0, 10 ) = TO_CHAR( SYSDATE - 1, 'YYYY-MM-DD' )
	ORDER BY t.INPUTTIME, t.MATERIALNAME, t.ITEM
  </select>

  <!--
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from IF_MES_EMS_WATERMONITOR
    where WTBH = #{wtbh,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from IF_MES_EMS_WATERMONITOR
    where 1!=1 
      <if test="materialno != null and materialno != ''">
        and MATERIALNO = #{materialno}
      </if>
      <if test="materialname != null and materialname != ''">
        and MATERIALNAME = #{materialname}
      </if>
      <if test="itemcode != null and itemcode != ''">
        and ITEMCODE = #{itemcode}
      </if>
      <if test="item != null and item != ''">
        and ITEM = #{item}
      </if>
      <if test="testresult != null and testresult != ''">
        and TESTRESULT = #{testresult}
      </if>
      <if test="itemjudgeresult != null and itemjudgeresult != ''">
        and ITEMJUDGERESULT = #{itemjudgeresult}
      </if>
      <if test="judgeresult != null and judgeresult != ''">
        and JUDGERESULT = #{judgeresult}
      </if>
      <if test="sampletype != null and sampletype != ''">
        and SAMPLETYPE = #{sampletype}
      </if>
      <if test="inputtime != null and inputtime != ''">
        and INPUTTIME = #{inputtime}
      </if>
      <if test="judgetime != null and judgetime != ''">
        and JUDGETIME = #{judgetime}
      </if>
      <if test="recorder != null and recorder != ''">
        and RECORDER = #{recorder}
      </if>
      <if test="sampleno != null and sampleno != ''">
        and SAMPLENO = #{sampleno}
      </if>
      <if test="sampleperson != null and sampleperson != ''">
        and SAMPLEPERSON = #{sampleperson}
      </if>
      <if test="sampletime != null and sampletime != ''">
        and SAMPLETIME = #{sampletime}
      </if>
      <if test="sender != null and sender != ''">
        and SENDER = #{sender}
      </if>
      <if test="sendtime != null and sendtime != ''">
        and SENDTIME = #{sendtime}
      </if>
      <if test="memo != null and memo != ''">
        and MEMO = #{memo}
      </if>
      <if test="materialsource != null and materialsource != ''">
        and MATERIALSOURCE = #{materialsource}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.ems.ifmesemswatermonitor.model.IfMesEmsWatermonitor">
    insert into IF_MES_EMS_WATERMONITOR (WTBH, MATERIALNO, MATERIALNAME, 
      ITEMCODE, ITEM, TESTRESULT, 
      ITEMJUDGERESULT, JUDGERESULT, SAMPLETYPE,
      INPUTTIME, JUDGETIME, RECORDER, 
      SAMPLENO, SAMPLEPERSON, SAMPLETIME, 
      SENDER, SENDTIME, MEMO, 
      MATERIALSOURCE)
    values (#{wtbh,jdbcType=VARCHAR}, #{materialno,jdbcType=VARCHAR}, #{materialname,jdbcType=VARCHAR}, 
      #{itemcode,jdbcType=VARCHAR}, #{item,jdbcType=VARCHAR}, #{testresult,jdbcType=VARCHAR}, 
      #{itemjudgeresult,jdbcType=VARCHAR}, #{judgeresult,jdbcType=VARCHAR}, #{sampletype,jdbcType=VARCHAR},
      #{inputtime,jdbcType=VARCHAR}, #{judgetime,jdbcType=VARCHAR}, #{recorder,jdbcType=VARCHAR}, 
      #{sampleno,jdbcType=VARCHAR}, #{sampleperson,jdbcType=VARCHAR}, #{sampletime,jdbcType=VARCHAR}, 
      #{sender,jdbcType=VARCHAR}, #{sendtime,jdbcType=VARCHAR}, #{memo,jdbcType=VARCHAR}, 
      #{materialsource,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.ems.ifmesemswatermonitor.model.IfMesEmsWatermonitor">
    insert into IF_MES_EMS_WATERMONITOR
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="wtbh != null">
        WTBH,
      </if>
      <if test="materialno != null">
        MATERIALNO,
      </if>
      <if test="materialname != null">
        MATERIALNAME,
      </if>
      <if test="itemcode != null">
        ITEMCODE,
      </if>
      <if test="item != null">
        ITEM,
      </if>
      <if test="testresult != null">
        TESTRESULT,
      </if>
      <if test="itemjudgeresult != null">
        ITEMJUDGERESULT,
      </if>
      <if test="judgeresult != null">
        JUDGERESULT,
      </if>
      <if test="sampletype != null">
        SAMPLETYPE,
      </if>
      <if test="inputtime != null">
        INPUTTIME,
      </if>
      <if test="judgetime != null">
        JUDGETIME,
      </if>
      <if test="recorder != null">
        RECORDER,
      </if>
      <if test="sampleno != null">
        SAMPLENO,
      </if>
      <if test="sampleperson != null">
        SAMPLEPERSON,
      </if>
      <if test="sampletime != null">
        SAMPLETIME,
      </if>
      <if test="sender != null">
        SENDER,
      </if>
      <if test="sendtime != null">
        SENDTIME,
      </if>
      <if test="memo != null">
        MEMO,
      </if>
      <if test="materialsource != null">
        MATERIALSOURCE,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="wtbh != null">
        #{wtbh,jdbcType=VARCHAR},
      </if>
      <if test="materialno != null">
        #{materialno,jdbcType=VARCHAR},
      </if>
      <if test="materialname != null">
        #{materialname,jdbcType=VARCHAR},
      </if>
      <if test="itemcode != null">
        #{itemcode,jdbcType=VARCHAR},
      </if>
      <if test="item != null">
        #{item,jdbcType=VARCHAR},
      </if>
      <if test="testresult != null">
        #{testresult,jdbcType=VARCHAR},
      </if>
      <if test="itemjudgeresult != null">
        #{itemjudgeresult,jdbcType=VARCHAR},
      </if>
      <if test="judgeresult != null">
        #{judgeresult,jdbcType=VARCHAR},
      </if>
      <if test="sampletype != null">
        #{sampletype,jdbcType=VARCHAR},
      </if>
      <if test="inputtime != null">
        #{inputtime,jdbcType=VARCHAR},
      </if>
      <if test="judgetime != null">
        #{judgetime,jdbcType=VARCHAR},
      </if>
      <if test="recorder != null">
        #{recorder,jdbcType=VARCHAR},
      </if>
      <if test="sampleno != null">
        #{sampleno,jdbcType=VARCHAR},
      </if>
      <if test="sampleperson != null">
        #{sampleperson,jdbcType=VARCHAR},
      </if>
      <if test="sampletime != null">
        #{sampletime,jdbcType=VARCHAR},
      </if>
      <if test="sender != null">
        #{sender,jdbcType=VARCHAR},
      </if>
      <if test="sendtime != null">
        #{sendtime,jdbcType=VARCHAR},
      </if>
      <if test="memo != null">
        #{memo,jdbcType=VARCHAR},
      </if>
      <if test="materialsource != null">
        #{materialsource,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.ifmesemswatermonitor.model.IfMesEmsWatermonitor">
    update IF_MES_EMS_WATERMONITOR
    set MATERIALNO = #{materialno,jdbcType=VARCHAR},
      MATERIALNAME = #{materialname,jdbcType=VARCHAR},
      ITEMCODE = #{itemcode,jdbcType=VARCHAR},
      ITEM = #{item,jdbcType=VARCHAR},
      TESTRESULT = #{testresult,jdbcType=VARCHAR},
      ITEMJUDGERESULT = #{itemjudgeresult,jdbcType=VARCHAR},
      JUDGERESULT = #{judgeresult,jdbcType=VARCHAR},
      SAMPLETYPE = #{sampletype,jdbcType=VARCHAR},
      INPUTTIME = #{inputtime,jdbcType=VARCHAR},
      JUDGETIME = #{judgetime,jdbcType=VARCHAR},
      RECORDER = #{recorder,jdbcType=VARCHAR},
      SAMPLENO = #{sampleno,jdbcType=VARCHAR},
      SAMPLEPERSON = #{sampleperson,jdbcType=VARCHAR},
      SAMPLETIME = #{sampletime,jdbcType=VARCHAR},
      SENDER = #{sender,jdbcType=VARCHAR},
      SENDTIME = #{sendtime,jdbcType=VARCHAR},
      MEMO = #{memo,jdbcType=VARCHAR},
      MATERIALSOURCE = #{materialsource,jdbcType=VARCHAR}
    where WTBH = #{wtbh,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.ifmesemswatermonitor.model.IfMesEmsWatermonitor">
    update IF_MES_EMS_WATERMONITOR
    <set>
      <if test="materialno != null">
        MATERIALNO = #{materialno,jdbcType=VARCHAR},
      </if>
      <if test="materialname != null">
        MATERIALNAME = #{materialname,jdbcType=VARCHAR},
      </if>
      <if test="itemcode != null">
        ITEMCODE = #{itemcode,jdbcType=VARCHAR},
      </if>
      <if test="item != null">
        ITEM = #{item,jdbcType=VARCHAR},
      </if>
      <if test="testresult != null">
        TESTRESULT = #{testresult,jdbcType=VARCHAR},
      </if>
      <if test="itemjudgeresult != null">
        ITEMJUDGERESULT = #{itemjudgeresult,jdbcType=VARCHAR},
      </if>
      <if test="judgeresult != null">
        JUDGERESULT = #{judgeresult,jdbcType=VARCHAR},
      </if>
      <if test="sampletype != null">
        SAMPLETYPE = #{sampletype,jdbcType=VARCHAR},
      </if>
      <if test="inputtime != null">
        INPUTTIME = #{inputtime,jdbcType=VARCHAR},
      </if>
      <if test="judgetime != null">
        JUDGETIME = #{judgetime,jdbcType=VARCHAR},
      </if>
      <if test="recorder != null">
        RECORDER = #{recorder,jdbcType=VARCHAR},
      </if>
      <if test="sampleno != null">
        SAMPLENO = #{sampleno,jdbcType=VARCHAR},
      </if>
      <if test="sampleperson != null">
        SAMPLEPERSON = #{sampleperson,jdbcType=VARCHAR},
      </if>
      <if test="sampletime != null">
        SAMPLETIME = #{sampletime,jdbcType=VARCHAR},
      </if>
      <if test="sender != null">
        SENDER = #{sender,jdbcType=VARCHAR},
      </if>
      <if test="sendtime != null">
        SENDTIME = #{sendtime,jdbcType=VARCHAR},
      </if>
      <if test="memo != null">
        MEMO = #{memo,jdbcType=VARCHAR},
      </if>
      <if test="materialsource != null">
        MATERIALSOURCE = #{materialsource,jdbcType=VARCHAR},
      </if>
    </set>
    where WTBH = #{wtbh,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    select WTBH, MATERIALNO, MATERIALNAME, ITEMCODE, ITEM, TESTRESULT, ITEMJUDGERESULT, JUDGERESULT,
    SAMPLETYPE, INPUTTIME, JUDGETIME, RECORDER, SAMPLENO, SAMPLEPERSON, SAMPLETIME, SENDER, 
    SENDTIME, MEMO, MATERIALSOURCE
    from IF_MES_EMS_WATERMONITOR
    where WTBH = #{wtbh,jdbcType=VARCHAR}
  </select>
  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    select WTBH, MATERIALNO, MATERIALNAME, ITEMCODE, ITEM, TESTRESULT, ITEMJUDGERESULT, JUDGERESULT,
    SAMPLETYPE, INPUTTIME, JUDGETIME, RECORDER, SAMPLENO, SAMPLEPERSON, SAMPLETIME, SENDER, 
    SENDTIME, MEMO, MATERIALSOURCE
    from IF_MES_EMS_WATERMONITOR
    <where> 
      <if test="materialno != null and materialno != ''">
        and MATERIALNO = #{materialno}
      </if>
      <if test="materialname != null and materialname != ''">
        and MATERIALNAME = #{materialname}
      </if>
      <if test="itemcode != null and itemcode != ''">
        and ITEMCODE = #{itemcode}
      </if>
      <if test="item != null and item != ''">
        and ITEM = #{item}
      </if>
      <if test="testresult != null and testresult != ''">
        and TESTRESULT = #{testresult}
      </if>
      <if test="itemjudgeresult != null and itemjudgeresult != ''">
        and ITEMJUDGERESULT = #{itemjudgeresult}
      </if>
      <if test="judgeresult != null and judgeresult != ''">
        and JUDGERESULT = #{judgeresult}
      </if>
      <if test="sampletype != null and sampletype != ''">
        and SAMPLETYPE = #{sampletype}
      </if>
      <if test="inputtime != null and inputtime != ''">
        and INPUTTIME = #{inputtime}
      </if>
      <if test="judgetime != null and judgetime != ''">
        and JUDGETIME = #{judgetime}
      </if>
      <if test="recorder != null and recorder != ''">
        and RECORDER = #{recorder}
      </if>
      <if test="sampleno != null and sampleno != ''">
        and SAMPLENO = #{sampleno}
      </if>
      <if test="sampleperson != null and sampleperson != ''">
        and SAMPLEPERSON = #{sampleperson}
      </if>
      <if test="sampletime != null and sampletime != ''">
        and SAMPLETIME = #{sampletime}
      </if>
      <if test="sender != null and sender != ''">
        and SENDER = #{sender}
      </if>
      <if test="sendtime != null and sendtime != ''">
        and SENDTIME = #{sendtime}
      </if>
      <if test="memo != null and memo != ''">
        and MEMO = #{memo}
      </if>
      <if test="materialsource != null and materialsource != ''">
        and MATERIALSOURCE = #{materialsource}
      </if>
    </where>
  </select>
  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    select WTBH, MATERIALNO, MATERIALNAME, ITEMCODE, ITEM, TESTRESULT, ITEMJUDGERESULT, JUDGERESULT,
    SAMPLETYPE, INPUTTIME, JUDGETIME, RECORDER, SAMPLENO, SAMPLEPERSON, SAMPLETIME, SENDER, 
    SENDTIME, MEMO, MATERIALSOURCE
    from IF_MES_EMS_WATERMONITOR
    <where> 
      <if test="materialno != null and materialno != ''">
        and MATERIALNO LIKE '%${materialno}%'
      </if>
      <if test="materialname != null and materialname != ''">
        and MATERIALNAME LIKE '%${materialname}%'
      </if>
      <if test="itemcode != null and itemcode != ''">
        and ITEMCODE LIKE '%${itemcode}%'
      </if>
      <if test="item != null and item != ''">
        and ITEM LIKE '%${item}%'
      </if>
      <if test="testresult != null and testresult != ''">
        and TESTRESULT LIKE '%${testresult}%'
      </if>
      <if test="itemjudgeresult != null and itemjudgeresult != ''">
        and ITEMJUDGERESULT LIKE '%${itemjudgeresult}%'
      </if>
      <if test="judgeresult != null and judgeresult != ''">
        and JUDGERESULT LIKE '%${judgeresult}%'
      </if>
      <if test="sampletype != null and sampletype != ''">
        and SAMPLETYPE LIKE '%${sampletype}%'
      </if>
      <if test="inputtime != null and inputtime != ''">
        and INPUTTIME LIKE '%${inputtime}%'
      </if>
      <if test="judgetime != null and judgetime != ''">
        and JUDGETIME LIKE '%${judgetime}%'
      </if>
      <if test="recorder != null and recorder != ''">
        and RECORDER LIKE '%${recorder}%'
      </if>
      <if test="sampleno != null and sampleno != ''">
        and SAMPLENO LIKE '%${sampleno}%'
      </if>
      <if test="sampleperson != null and sampleperson != ''">
        and SAMPLEPERSON LIKE '%${sampleperson}%'
      </if>
      <if test="sampletime != null and sampletime != ''">
        and SAMPLETIME LIKE '%${sampletime}%'
      </if>
      <if test="sender != null and sender != ''">
        and SENDER LIKE '%${sender}%'
      </if>
      <if test="sendtime != null and sendtime != ''">
        and SENDTIME LIKE '%${sendtime}%'
      </if>
      <if test="memo != null and memo != ''">
        and MEMO LIKE '%${memo}%'
      </if>
      <if test="materialsource != null and materialsource != ''">
        and MATERIALSOURCE LIKE '%${materialsource}%'
      </if>
    </where>
  </select>
  <insert id="batchInsert" parameterType="java.util.List">
    insert into IF_MES_EMS_WATERMONITOR 
      (WTBH, 
      MATERIALNO, MATERIALNAME, ITEMCODE, 
      ITEM, TESTRESULT, ITEMJUDGERESULT,
      JUDGERESULT, SAMPLETYPE, INPUTTIME, 
      JUDGETIME, RECORDER, SAMPLENO, 
      SAMPLEPERSON, SAMPLETIME, SENDER, 
      SENDTIME, MEMO, MATERIALSOURCE
      )
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.wtbh,jdbcType=VARCHAR}, 
      #{item.materialno,jdbcType=VARCHAR}, #{item.materialname,jdbcType=VARCHAR}, #{item.itemcode,jdbcType=VARCHAR}, 
      #{item.item,jdbcType=VARCHAR}, #{item.testresult,jdbcType=VARCHAR}, #{item.itemjudgeresult,jdbcType=VARCHAR},
      #{item.judgeresult,jdbcType=VARCHAR}, #{item.sampletype,jdbcType=VARCHAR}, #{item.inputtime,jdbcType=VARCHAR}, 
      #{item.judgetime,jdbcType=VARCHAR}, #{item.recorder,jdbcType=VARCHAR}, #{item.sampleno,jdbcType=VARCHAR}, 
      #{item.sampleperson,jdbcType=VARCHAR}, #{item.sampletime,jdbcType=VARCHAR}, #{item.sender,jdbcType=VARCHAR}, 
      #{item.sendtime,jdbcType=VARCHAR}, #{item.memo,jdbcType=VARCHAR}, #{item.materialsource,jdbcType=VARCHAR}
       from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update IF_MES_EMS_WATERMONITOR
     set
       WTBH=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.wtbh,jdbcType=VARCHAR}
       </foreach>
       ,MATERIALNO=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.materialno,jdbcType=VARCHAR}
       </foreach>
       ,MATERIALNAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.materialname,jdbcType=VARCHAR}
       </foreach>
       ,ITEMCODE=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.itemcode,jdbcType=VARCHAR}
       </foreach>
       ,ITEM=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.item,jdbcType=VARCHAR}
       </foreach>
       ,TESTRESULT=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.testresult,jdbcType=VARCHAR}
       </foreach>
       ,ITEMJUDGERESULT=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.itemjudgeresult,jdbcType=VARCHAR}
       </foreach>
       ,JUDGERESULT=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.judgeresult,jdbcType=VARCHAR}
       </foreach>
       ,SAMPLETYPE=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.sampletype,jdbcType=VARCHAR}
       </foreach>
       ,INPUTTIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.inputtime,jdbcType=VARCHAR}
       </foreach>
       ,JUDGETIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.judgetime,jdbcType=VARCHAR}
       </foreach>
       ,RECORDER=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.recorder,jdbcType=VARCHAR}
       </foreach>
       ,SAMPLENO=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.sampleno,jdbcType=VARCHAR}
       </foreach>
       ,SAMPLEPERSON=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.sampleperson,jdbcType=VARCHAR}
       </foreach>
       ,SAMPLETIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.sampletime,jdbcType=VARCHAR}
       </foreach>
       ,SENDER=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.sender,jdbcType=VARCHAR}
       </foreach>
       ,SENDTIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.sendtime,jdbcType=VARCHAR}
       </foreach>
       ,MEMO=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.memo,jdbcType=VARCHAR}
       </foreach>
       ,MATERIALSOURCE=
       <foreach collection="list" item="item" index="index" separator=" " open="case WTBH" close="end">
          when #{item.wtbh,jdbcType=VARCHAR} then #{item.materialsource,jdbcType=VARCHAR}
       </foreach>
     where WTBH in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.wtbh,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from IF_MES_EMS_WATERMONITOR
    where WTBH in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  -->
</mapper>