<?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.trmtransfereactvalue.mapper.TRmTransfereActValueMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.ems.trmtransfereactvalue.model.TRmTransfereActValue">
    <id column="ID" jdbcType="VARCHAR" property="id" />
    <result column="CLOCK" jdbcType="VARCHAR" property="clock" />
    <result column="WORKPROCID" jdbcType="VARCHAR" property="workprocid" />
    <result column="LOCATION" jdbcType="VARCHAR" property="location" />
    <result column="APPORTVALUE" jdbcType="DECIMAL" property="apportvalue" />
    <result column="MINTVALUE" jdbcType="DECIMAL" property="mintvalue" />
    <result column="MENDVALUE" jdbcType="DECIMAL" property="mendvalue" />
    <result column="STATE" jdbcType="VARCHAR" property="state" />
    <result column="CREATER" jdbcType="VARCHAR" property="creater" />
    <result column="CREATETIM" jdbcType="VARCHAR" property="createtim" />
    <result column="CHECKUSER" jdbcType="VARCHAR" property="checkuser" />
    <result column="CHECKTIM" jdbcType="VARCHAR" property="checktim" />
    <result column="BZ" jdbcType="VARCHAR" property="bz" />
    <result column="LOCATIONID" jdbcType="VARCHAR" property="locationid" />
    <result column="WASTAGE" jdbcType="DECIMAL" property="wastage" />
    <result column="REALVALUE" jdbcType="DECIMAL" property="realvalue" />
    <result column="SECONDVALUE" jdbcType="DECIMAL" property="secondvalue" />
    <result column="WORKSHOP" jdbcType="VARCHAR" property="workshop" />
    <result column="ITEMID" jdbcType="VARCHAR" property="itemid" />
    <result column="CLOCKE" jdbcType="VARCHAR" property="clocke" />
  </resultMap>
  <sql id="columns">
    ID, CLOCK, WORKPROCID, LOCATION, APPORTVALUE, MINTVALUE, MENDVALUE, STATE, CREATER, 
    CREATETIM, CHECKUSER, CHECKTIM, BZ, LOCATIONID, WASTAGE, REALVALUE, SECONDVALUE, 
    WORKSHOP, ITEMID, CLOCKE
  </sql>
  <sql id="columns_alias">
    t.ID, t.CLOCK, t.WORKPROCID, t.LOCATION, t.APPORTVALUE, t.MINTVALUE, t.MENDVALUE, 
    t.STATE, t.CREATER, t.CREATETIM, t.CHECKUSER, t.CHECKTIM, t.BZ, t.LOCATIONID, t.WASTAGE, 
    t.REALVALUE, t.SECONDVALUE, t.WORKSHOP, t.ITEMID, t.CLOCKE
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM T_RM_TRANSFERE_ACT_VALUE
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM T_RM_TRANSFERE_ACT_VALUE t
  </sql>
  <sql id="where">
    <where> 
      <if test="clock != null and clock != ''">
        and CLOCK = #{clock}
      </if>
      <if test="workprocid != null and workprocid != ''">
        and WORKPROCID = #{workprocid}
      </if>
      <if test="location != null and location != ''">
        and LOCATION = #{location}
      </if>
      <if test="apportvalue != null">
        and APPORTVALUE = #{apportvalue}
      </if>
      <if test="mintvalue != null">
        and MINTVALUE = #{mintvalue}
      </if>
      <if test="mendvalue != null">
        and MENDVALUE = #{mendvalue}
      </if>
      <if test="state != null and state != ''">
        and STATE = #{state}
      </if>
      <if test="creater != null and creater != ''">
        and CREATER = #{creater}
      </if>
      <if test="createtim != null and createtim != ''">
        and CREATETIM = #{createtim}
      </if>
      <if test="checkuser != null and checkuser != ''">
        and CHECKUSER = #{checkuser}
      </if>
      <if test="checktim != null and checktim != ''">
        and CHECKTIM = #{checktim}
      </if>
      <if test="bz != null and bz != ''">
        and BZ = #{bz}
      </if>
      <if test="locationid != null and locationid != ''">
        and LOCATIONID = #{locationid}
      </if>
      <if test="wastage != null">
        and WASTAGE = #{wastage}
      </if>
      <if test="realvalue != null">
        and REALVALUE = #{realvalue}
      </if>
      <if test="secondvalue != null">
        and SECONDVALUE = #{secondvalue}
      </if>
      <if test="workshop != null and workshop != ''">
        and WORKSHOP = #{workshop}
      </if>
      <if test="itemid != null and itemid != ''">
        and ITEMID = #{itemid}
      </if>
      <if test="clocke != null and clocke != ''">
        and CLOCKE = #{clocke}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <if test="clock != null and clock != ''">
        and CLOCK LIKE '%${clock}%'
      </if>
      <if test="workprocid != null and workprocid != ''">
        and WORKPROCID LIKE '%${workprocid}%'
      </if>
      <if test="location != null and location != ''">
        and LOCATION LIKE '%${location}%'
      </if>
      <if test="apportvalue != null">
        and APPORTVALUE = #{apportvalue}
      </if>
      <if test="mintvalue != null">
        and MINTVALUE = #{mintvalue}
      </if>
      <if test="mendvalue != null">
        and MENDVALUE = #{mendvalue}
      </if>
      <if test="state != null and state != ''">
        and STATE LIKE '%${state}%'
      </if>
      <if test="creater != null and creater != ''">
        and CREATER LIKE '%${creater}%'
      </if>
      <if test="createtim != null and createtim != ''">
        and CREATETIM LIKE '%${createtim}%'
      </if>
      <if test="checkuser != null and checkuser != ''">
        and CHECKUSER LIKE '%${checkuser}%'
      </if>
      <if test="checktim != null and checktim != ''">
        and CHECKTIM LIKE '%${checktim}%'
      </if>
      <if test="bz != null and bz != ''">
        and BZ LIKE '%${bz}%'
      </if>
      <if test="locationid != null and locationid != ''">
        and LOCATIONID LIKE '%${locationid}%'
      </if>
      <if test="wastage != null">
        and WASTAGE = #{wastage}
      </if>
      <if test="realvalue != null">
        and REALVALUE = #{realvalue}
      </if>
      <if test="secondvalue != null">
        and SECONDVALUE = #{secondvalue}
      </if>
      <if test="workshop != null and workshop != ''">
        and WORKSHOP LIKE '%${workshop}%'
      </if>
      <if test="itemid != null and itemid != ''">
        and ITEMID LIKE '%${itemid}%'
      </if>
      <if test="clocke != null and clocke != ''">
        and CLOCKE LIKE '%${clocke}%'
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from T_RM_TRANSFERE_ACT_VALUE
    where ID = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from T_RM_TRANSFERE_ACT_VALUE
    where 1!=1 
      <if test="clock != null and clock != ''">
        or CLOCK = #{clock}
      </if>
      <if test="workprocid != null and workprocid != ''">
        or WORKPROCID = #{workprocid}
      </if>
      <if test="location != null and location != ''">
        or LOCATION = #{location}
      </if>
      <if test="apportvalue != null">
        or APPORTVALUE = #{apportvalue}
      </if>
      <if test="mintvalue != null">
        or MINTVALUE = #{mintvalue}
      </if>
      <if test="mendvalue != null">
        or MENDVALUE = #{mendvalue}
      </if>
      <if test="state != null and state != ''">
        or STATE = #{state}
      </if>
      <if test="creater != null and creater != ''">
        or CREATER = #{creater}
      </if>
      <if test="createtim != null and createtim != ''">
        or CREATETIM = #{createtim}
      </if>
      <if test="checkuser != null and checkuser != ''">
        or CHECKUSER = #{checkuser}
      </if>
      <if test="checktim != null and checktim != ''">
        or CHECKTIM = #{checktim}
      </if>
      <if test="bz != null and bz != ''">
        or BZ = #{bz}
      </if>
      <if test="locationid != null and locationid != ''">
        or LOCATIONID = #{locationid}
      </if>
      <if test="wastage != null">
        or WASTAGE = #{wastage}
      </if>
      <if test="realvalue != null">
        or REALVALUE = #{realvalue}
      </if>
      <if test="secondvalue != null">
        or SECONDVALUE = #{secondvalue}
      </if>
      <if test="workshop != null and workshop != ''">
        or WORKSHOP = #{workshop}
      </if>
      <if test="itemid != null and itemid != ''">
        or ITEMID = #{itemid}
      </if>
      <if test="clocke != null and clocke != ''">
        or CLOCKE = #{clocke}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.ems.trmtransfereactvalue.model.TRmTransfereActValue">
    insert into T_RM_TRANSFERE_ACT_VALUE (ID, CLOCK, WORKPROCID, 
      LOCATION, APPORTVALUE, MINTVALUE, 
      MENDVALUE, STATE, CREATER, 
      CREATETIM, CHECKUSER, CHECKTIM, 
      BZ, LOCATIONID, WASTAGE, 
      REALVALUE, SECONDVALUE, WORKSHOP, 
      ITEMID, CLOCKE)
    values (#{id,jdbcType=VARCHAR}, #{clock,jdbcType=VARCHAR}, #{workprocid,jdbcType=VARCHAR}, 
      #{location,jdbcType=VARCHAR}, #{apportvalue,jdbcType=DECIMAL}, #{mintvalue,jdbcType=DECIMAL}, 
      #{mendvalue,jdbcType=DECIMAL}, #{state,jdbcType=VARCHAR}, #{creater,jdbcType=VARCHAR}, 
      #{createtim,jdbcType=VARCHAR}, #{checkuser,jdbcType=VARCHAR}, #{checktim,jdbcType=VARCHAR}, 
      #{bz,jdbcType=VARCHAR}, #{locationid,jdbcType=VARCHAR}, #{wastage,jdbcType=DECIMAL}, 
      #{realvalue,jdbcType=DECIMAL}, #{secondvalue,jdbcType=DECIMAL}, #{workshop,jdbcType=VARCHAR}, 
      #{itemid,jdbcType=VARCHAR}, #{clocke,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.ems.trmtransfereactvalue.model.TRmTransfereActValue">
    insert into T_RM_TRANSFERE_ACT_VALUE
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        ID,
      </if>
      <if test="clock != null">
        CLOCK,
      </if>
      <if test="workprocid != null">
        WORKPROCID,
      </if>
      <if test="location != null">
        LOCATION,
      </if>
      <if test="apportvalue != null">
        APPORTVALUE,
      </if>
      <if test="mintvalue != null">
        MINTVALUE,
      </if>
      <if test="mendvalue != null">
        MENDVALUE,
      </if>
      <if test="state != null">
        STATE,
      </if>
      <if test="creater != null">
        CREATER,
      </if>
      <if test="createtim != null">
        CREATETIM,
      </if>
      <if test="checkuser != null">
        CHECKUSER,
      </if>
      <if test="checktim != null">
        CHECKTIM,
      </if>
      <if test="bz != null">
        BZ,
      </if>
      <if test="locationid != null">
        LOCATIONID,
      </if>
      <if test="wastage != null">
        WASTAGE,
      </if>
      <if test="realvalue != null">
        REALVALUE,
      </if>
      <if test="secondvalue != null">
        SECONDVALUE,
      </if>
      <if test="workshop != null">
        WORKSHOP,
      </if>
      <if test="itemid != null">
        ITEMID,
      </if>
      <if test="clocke != null">
        CLOCKE,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="clock != null">
        #{clock,jdbcType=VARCHAR},
      </if>
      <if test="workprocid != null">
        #{workprocid,jdbcType=VARCHAR},
      </if>
      <if test="location != null">
        #{location,jdbcType=VARCHAR},
      </if>
      <if test="apportvalue != null">
        #{apportvalue,jdbcType=DECIMAL},
      </if>
      <if test="mintvalue != null">
        #{mintvalue,jdbcType=DECIMAL},
      </if>
      <if test="mendvalue != null">
        #{mendvalue,jdbcType=DECIMAL},
      </if>
      <if test="state != null">
        #{state,jdbcType=VARCHAR},
      </if>
      <if test="creater != null">
        #{creater,jdbcType=VARCHAR},
      </if>
      <if test="createtim != null">
        #{createtim,jdbcType=VARCHAR},
      </if>
      <if test="checkuser != null">
        #{checkuser,jdbcType=VARCHAR},
      </if>
      <if test="checktim != null">
        #{checktim,jdbcType=VARCHAR},
      </if>
      <if test="bz != null">
        #{bz,jdbcType=VARCHAR},
      </if>
      <if test="locationid != null">
        #{locationid,jdbcType=VARCHAR},
      </if>
      <if test="wastage != null">
        #{wastage,jdbcType=DECIMAL},
      </if>
      <if test="realvalue != null">
        #{realvalue,jdbcType=DECIMAL},
      </if>
      <if test="secondvalue != null">
        #{secondvalue,jdbcType=DECIMAL},
      </if>
      <if test="workshop != null">
        #{workshop,jdbcType=VARCHAR},
      </if>
      <if test="itemid != null">
        #{itemid,jdbcType=VARCHAR},
      </if>
      <if test="clocke != null">
        #{clocke,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.trmtransfereactvalue.model.TRmTransfereActValue">
    update T_RM_TRANSFERE_ACT_VALUE
    set CLOCK = #{clock,jdbcType=VARCHAR},
      WORKPROCID = #{workprocid,jdbcType=VARCHAR},
      LOCATION = #{location,jdbcType=VARCHAR},
      APPORTVALUE = #{apportvalue,jdbcType=DECIMAL},
      MINTVALUE = #{mintvalue,jdbcType=DECIMAL},
      MENDVALUE = #{mendvalue,jdbcType=DECIMAL},
      STATE = #{state,jdbcType=VARCHAR},
      CREATER = #{creater,jdbcType=VARCHAR},
      CREATETIM = #{createtim,jdbcType=VARCHAR},
      CHECKUSER = #{checkuser,jdbcType=VARCHAR},
      CHECKTIM = #{checktim,jdbcType=VARCHAR},
      BZ = #{bz,jdbcType=VARCHAR},
      LOCATIONID = #{locationid,jdbcType=VARCHAR},
      WASTAGE = #{wastage,jdbcType=DECIMAL},
      REALVALUE = #{realvalue,jdbcType=DECIMAL},
      SECONDVALUE = #{secondvalue,jdbcType=DECIMAL},
      WORKSHOP = #{workshop,jdbcType=VARCHAR},
      ITEMID = #{itemid,jdbcType=VARCHAR},
      CLOCKE = #{clocke,jdbcType=VARCHAR}
    where ID = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.trmtransfereactvalue.model.TRmTransfereActValue">
    update T_RM_TRANSFERE_ACT_VALUE
    <set>
      <if test="clock != null">
        CLOCK = #{clock,jdbcType=VARCHAR},
      </if>
      <if test="workprocid != null">
        WORKPROCID = #{workprocid,jdbcType=VARCHAR},
      </if>
      <if test="location != null">
        LOCATION = #{location,jdbcType=VARCHAR},
      </if>
      <if test="apportvalue != null">
        APPORTVALUE = #{apportvalue,jdbcType=DECIMAL},
      </if>
      <if test="mintvalue != null">
        MINTVALUE = #{mintvalue,jdbcType=DECIMAL},
      </if>
      <if test="mendvalue != null">
        MENDVALUE = #{mendvalue,jdbcType=DECIMAL},
      </if>
      <if test="state != null">
        STATE = #{state,jdbcType=VARCHAR},
      </if>
      <if test="creater != null">
        CREATER = #{creater,jdbcType=VARCHAR},
      </if>
      <if test="createtim != null">
        CREATETIM = #{createtim,jdbcType=VARCHAR},
      </if>
      <if test="checkuser != null">
        CHECKUSER = #{checkuser,jdbcType=VARCHAR},
      </if>
      <if test="checktim != null">
        CHECKTIM = #{checktim,jdbcType=VARCHAR},
      </if>
      <if test="bz != null">
        BZ = #{bz,jdbcType=VARCHAR},
      </if>
      <if test="locationid != null">
        LOCATIONID = #{locationid,jdbcType=VARCHAR},
      </if>
      <if test="wastage != null">
        WASTAGE = #{wastage,jdbcType=DECIMAL},
      </if>
      <if test="realvalue != null">
        REALVALUE = #{realvalue,jdbcType=DECIMAL},
      </if>
      <if test="secondvalue != null">
        SECONDVALUE = #{secondvalue,jdbcType=DECIMAL},
      </if>
      <if test="workshop != null">
        WORKSHOP = #{workshop,jdbcType=VARCHAR},
      </if>
      <if test="itemid != null">
        ITEMID = #{itemid,jdbcType=VARCHAR},
      </if>
      <if test="clocke != null">
        CLOCKE = #{clocke,jdbcType=VARCHAR},
      </if>
    </set>
    where ID = #{id,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where ID = #{id,jdbcType=VARCHAR}
  </select>
  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="where"/>
    order by clock,clocke
  </select>
  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="whereLike"/>
  </select>
  <insert id="batchInsert" parameterType="java.util.List">
    insert into T_RM_TRANSFERE_ACT_VALUE 
      (ID, 
      CLOCK, WORKPROCID, LOCATION, 
      APPORTVALUE, MINTVALUE, MENDVALUE, 
      STATE, CREATER, CREATETIM, 
      CHECKUSER, CHECKTIM, BZ, 
      LOCATIONID, WASTAGE, REALVALUE, 
      SECONDVALUE, WORKSHOP, ITEMID, 
      CLOCKE)
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.id,jdbcType=VARCHAR}, 
      #{item.clock,jdbcType=VARCHAR}, #{item.workprocid,jdbcType=VARCHAR}, #{item.location,jdbcType=VARCHAR}, 
      #{item.apportvalue,jdbcType=DECIMAL}, #{item.mintvalue,jdbcType=DECIMAL}, #{item.mendvalue,jdbcType=DECIMAL}, 
      #{item.state,jdbcType=VARCHAR}, #{item.creater,jdbcType=VARCHAR}, #{item.createtim,jdbcType=VARCHAR}, 
      #{item.checkuser,jdbcType=VARCHAR}, #{item.checktim,jdbcType=VARCHAR}, #{item.bz,jdbcType=VARCHAR}, 
      #{item.locationid,jdbcType=VARCHAR}, #{item.wastage,jdbcType=DECIMAL}, #{item.realvalue,jdbcType=DECIMAL}, 
      #{item.secondvalue,jdbcType=DECIMAL}, #{item.workshop,jdbcType=VARCHAR}, #{item.itemid,jdbcType=VARCHAR}, 
      #{item.clocke,jdbcType=VARCHAR} from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update T_RM_TRANSFERE_ACT_VALUE
     set
       ID=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.id,jdbcType=VARCHAR}
       </foreach>
       ,CLOCK=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.clock,jdbcType=VARCHAR}
       </foreach>
       ,WORKPROCID=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.workprocid,jdbcType=VARCHAR}
       </foreach>
       ,LOCATION=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.location,jdbcType=VARCHAR}
       </foreach>
       ,APPORTVALUE=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.apportvalue,jdbcType=DECIMAL}
       </foreach>
       ,MINTVALUE=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.mintvalue,jdbcType=DECIMAL}
       </foreach>
       ,MENDVALUE=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.mendvalue,jdbcType=DECIMAL}
       </foreach>
       ,STATE=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.state,jdbcType=VARCHAR}
       </foreach>
       ,CREATER=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.creater,jdbcType=VARCHAR}
       </foreach>
       ,CREATETIM=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.createtim,jdbcType=VARCHAR}
       </foreach>
       ,CHECKUSER=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.checkuser,jdbcType=VARCHAR}
       </foreach>
       ,CHECKTIM=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.checktim,jdbcType=VARCHAR}
       </foreach>
       ,BZ=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.bz,jdbcType=VARCHAR}
       </foreach>
       ,LOCATIONID=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.locationid,jdbcType=VARCHAR}
       </foreach>
       ,WASTAGE=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.wastage,jdbcType=DECIMAL}
       </foreach>
       ,REALVALUE=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.realvalue,jdbcType=DECIMAL}
       </foreach>
       ,SECONDVALUE=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.secondvalue,jdbcType=DECIMAL}
       </foreach>
       ,WORKSHOP=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.workshop,jdbcType=VARCHAR}
       </foreach>
       ,ITEMID=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.itemid,jdbcType=VARCHAR}
       </foreach>
       ,CLOCKE=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.clocke,jdbcType=VARCHAR}
       </foreach>
     where ID in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.id,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from T_RM_TRANSFERE_ACT_VALUE
    where ID in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->
  <!-- 转供电实绩数据，生成数据 -->
  <select id="getDateEdit2" parameterType="java.util.HashMap" resultType = "Map">
    select v.id, #{clock} clock,t.workprocid,t.location,v.apportvalue,v.mintvalue,v.mendvalue, v.wastage, v.secondvalue, v.realvalue,
    nvl(v.state,0) state,v.creater,v.createtim,v.checkuser,v.checktim,v.bz,t.itemname,t.bcode,t.mods,t.workshop,t.id locationid,t.seqno,t.type,t.itemid,
    (SELECT mendvalue from T_RM_TRANSFERE_ACT_VALUE where LOCATIONID =t.id and clock=(select max(clock) from T_RM_TRANSFERE_ACT_VALUE
    where clock &lt; #{clock} and LOCATIONID = t.id)) lastmendvalue
    from T_RM_ELECTRICITY_LOCATION t
    inner join T_RM_STATION s on t.workshop = s.id
    left join 
    T_RM_TRANSFERE_ACT_VALUE v on t.id = v.locationid and v.clock = #{clock}
    <where>
       <if test="networkid != null and networkid != ''">
         and t.workshop in (${networkid})
       </if>
       <if test="workprocid != null and workprocid != ''">
         and t.workprocid in (${workprocid})
       </if>
       <if test="location != null and location != ''">
         and t.location in (${location})
       </if>
       <if test="state != null and state != ''">
         and v.state = ${state}
       </if>
       and t.state = '1'
    </where>
    order by TO_NUMBER(t.seqno)
  </select>
  
  <!-- 转供电实绩数据，查询实绩数据，用于审核-->
  <select id="getDate" parameterType="java.util.HashMap" resultType = "Map">
    select v.id, v.clock,v.clocke,t.workprocid,t.location,v.apportvalue,v.mintvalue,v.mendvalue, v.wastage, v.secondvalue, v.realvalue,t.itemid,
    nvl(v.state,0) state,v.creater,v.createtim,v.checkuser,v.checktim,v.bz,t.itemname,t.bcode,t.mods,t.workshop,t.id locationid,t.seqno,t.type
    from T_RM_ELECTRICITY_LOCATION t
    inner join 
    T_RM_TRANSFERE_ACT_VALUE v on t.id = v.locationid
    <where>
       <if test="networkid != null and networkid != ''">
         and t.workshop in (${networkid})
       </if>
       <if test="workprocid != null and workprocid != ''">
         and t.workprocid in (${workprocid})
       </if>
       <if test="location != null and location != ''">
         and t.location in (${location})
       </if>
       <if test="clock1 != null and clock1 != ''">
         ${clock1}
       </if>
       <if test="state != null and state != ''">
         and v.state = #{state}
       </if>
       <if test="itemname != null and itemname != ''">
         and t.itemname LIKE '%${itemname}%'
       </if>
       <if test="measureid != null and measureid != ''">
         and v.itemid = #{measureid}
       </if>
    </where>
    order by clocke,clock,workshop,TO_NUMBER(t.seqno)
  </select>
  
  <!-- 转供电实绩数据，生成数据-日数据 -->
  <select id="getDateEdit" parameterType="java.util.HashMap" resultType = "Map">
    select #{clock} clock,#{clocke} clocke,t.workprocid,t.location,0 state,
    t.itemname,t.bcode,t.mods,t.workshop,t.id locationid,t.seqno,t.type,t.itemid,
    (SELECT max(mendvalue) from T_RM_TRANSFERE_ACT_VALUE where LOCATIONID =t.id and clocke=(select max(clocke) from
    T_RM_TRANSFERE_ACT_VALUE where clocke &lt;= #{clock} and LOCATIONID = t.id)) lastmendvalue
    from T_RM_ELECTRICITY_LOCATION t
    left join
    T_RM_CALPOINT m on t.itemid = m.itemid
    <where>
       <if test="networkid != null and networkid != ''">
         and t.workshop in (${networkid})
       </if>
       <if test="workprocid != null and workprocid != ''">
         and t.workprocid in (${workprocid})
       </if>
       <if test="location != null and location != ''">
         and t.location in (${location})
       </if>
       and t.state = '1'
       and m.itemtype = 'MANUAL'
       and not exists (select id from T_RM_TRANSFERE_ACT_VALUE where clock=#{clock} and clocke=#{clocke} and locationid=t.id)
    </where>
    order by workshop,TO_NUMBER(t.seqno)
  </select>
  
  <!-- 查询条件下已有数据数量 -->
  <select id="countDateEdit" parameterType="java.util.HashMap" resultType="java.lang.Long">
    select count(1) from T_RM_TRANSFERE_ACT_VALUE 
    <where>
       <if test="networkid != null and networkid != ''">
         and workshop in (${networkid})
       </if>
       <if test="workprocid != null and workprocid != ''">
         and workprocid in (${workprocid})
       </if>
       <if test="location != null and location != ''">
         and location in (${location})
       </if>
       <if test="clock != null and clock != ''">
         and clock = #{clock}
       </if>
       <if test="clocke != null and clocke != ''">
         and clocke = #{clocke}
       </if>
    </where>
  </select>
</mapper>