<?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.trmworkprocproduct.mapper.TRmWorkprocProductMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.ems.trmworkprocproduct.model.TRmWorkprocProduct">
    <id column="ITEMID" jdbcType="VARCHAR" property="itemid" />
    <result column="PRODUCTID" jdbcType="VARCHAR" property="productid" />
    <result column="WORKPROCID" jdbcType="VARCHAR" property="workprocid" />
    <result column="USEFLAG" jdbcType="VARCHAR" property="useflag" />
    <result column="ISPRIMARY" jdbcType="VARCHAR" property="isprimary" />
    <result column="ITEMTYPE" jdbcType="VARCHAR" property="itemtype" />
    <result column="UNITID" jdbcType="VARCHAR" property="unitid" />
    <result column="SEQNO" jdbcType="VARCHAR" property="seqno" />
    <result column="DIGITS" jdbcType="DECIMAL" property="digits" />
    <result column="MES_MATERIALCODE" jdbcType="VARCHAR" property="mesMaterialcode" />
    <result column="MES_PRODLINE" jdbcType="VARCHAR" property="mesProdline" />
    <result column="CODE" jdbcType="VARCHAR" property="code" />
    <result column="SHOWNO" jdbcType="DECIMAL" property="showno" />
    <result column="CREATEMAN" jdbcType="VARCHAR" property="createman" />
    <result column="CREATETIME" jdbcType="TIMESTAMP" property="createtime" />
    <result column="UPDATEMAN" jdbcType="VARCHAR" property="updateman" />
    <result column="UPDATETIME" jdbcType="TIMESTAMP" property="updatetime" />
    <result column="ITEMNAME" jdbcType="VARCHAR" property="itemname" />
    <result column="ISFINANCEDATA" jdbcType="VARCHAR" property="isfinancedata" />
    <result column="RTPITEMID" jdbcType="VARCHAR" property="rtpitemid" />
  </resultMap>
  <sql id="columns">
    ITEMID, PRODUCTID, WORKPROCID, USEFLAG, ISPRIMARY, ITEMTYPE, UNITID, SEQNO, DIGITS, 
    MES_MATERIALCODE, MES_PRODLINE, CODE, SHOWNO, CREATEMAN, CREATETIME, UPDATEMAN, UPDATETIME, 
    ITEMNAME, ISFINANCEDATA, RTPITEMID
  </sql>
  <sql id="columns_alias">
    t.ITEMID, t.PRODUCTID, t.WORKPROCID, t.USEFLAG, t.ISPRIMARY, t.ITEMTYPE, t.UNITID,
    t.SEQNO, t.DIGITS, t.MES_MATERIALCODE, t.MES_PRODLINE, t.CODE, t.SHOWNO, t.CREATEMAN,
    t.CREATETIME, t.UPDATEMAN, t.UPDATETIME, t.ITEMNAME, t.ISFINANCEDATA, t.RTPITEMID
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM T_RM_WORKPROC_PRODUCT
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM T_RM_WORKPROC_PRODUCT t
  </sql>
  <sql id="where">
    <where>
      <if test="itemid != null and itemid != ''">
        and ITEMID = #{itemid}
      </if>
      <if test="productid != null and productid != ''">
        and PRODUCTID = #{productid}
      </if>
      <if test="workprocid != null and workprocid != ''">
        and WORKPROCID = #{workprocid}
      </if>
      <if test="useflag != null and useflag != ''">
        and USEFLAG = #{useflag}
      </if>
      <if test="isprimary != null and isprimary != ''">
        and ISPRIMARY = #{isprimary}
      </if>
      <if test="itemtype != null and itemtype != ''">
        and ITEMTYPE = #{itemtype}
      </if>
      <if test="unitid != null and unitid != ''">
        and UNITID = #{unitid}
      </if>
      <if test="seqno != null and seqno != ''">
        and SEQNO = #{seqno}
      </if>
      <if test="digits != null">
        and DIGITS = #{digits}
      </if>
      <if test="mesMaterialcode != null and mesMaterialcode != ''">
        and MES_MATERIALCODE = #{mesMaterialcode}
      </if>
      <if test="mesProdline != null and mesProdline != ''">
        and MES_PRODLINE = #{mesProdline}
      </if>
      <if test="code != null and code != ''">
        and CODE = #{code}
      </if>
      <if test="showno != null">
        and SHOWNO = #{showno}
      </if>
      <if test="createman != null and createman != ''">
        and CREATEMAN = #{createman}
      </if>
      <if test="createtime != null">
        and TO_CHAR(CREATETIME,'yyyy-MM-dd') = #{createtime}
      </if>
      <if test="updateman != null and updateman != ''">
        and UPDATEMAN = #{updateman}
      </if>
      <if test="updatetime != null">
        and TO_CHAR(UPDATETIME,'yyyy-MM-dd') = #{updatetime}
      </if>
      <if test="itemname != null and itemname != ''">
        and ITEMNAME = #{itemname}
      </if>
      <if test="isfinancedata != null and isfinancedata != ''">
        and ISFINANCEDATA = #{isfinancedata}
      </if>
      <if test="rtpitemid != null and rtpitemid != ''">
        and RTPITEMID = #{rtpitemid}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where>
      <if test="itemid != null and itemid != ''">
        and ITEMID LIKE '%${itemid}%'
      </if>
      <if test="productid != null and productid != ''">
        and PRODUCTID LIKE '%${productid}%'
      </if>
      <if test="workprocid != null and workprocid != ''">
        and WORKPROCID LIKE '%${workprocid}%'
      </if>
      <if test="useflag != null and useflag != ''">
        and USEFLAG LIKE '%${useflag}%'
      </if>
      <if test="isprimary != null and isprimary != ''">
        and ISPRIMARY LIKE '%${isprimary}%'
      </if>
      <if test="itemtype != null and itemtype != ''">
        and ITEMTYPE LIKE '%${itemtype}%'
      </if>
      <if test="unitid != null and unitid != ''">
        and UNITID LIKE '%${unitid}%'
      </if>
      <if test="seqno != null and seqno != ''">
        and SEQNO LIKE '%${seqno}%'
      </if>
      <if test="digits != null">
        and DIGITS = #{digits}
      </if>
      <if test="mesMaterialcode != null and mesMaterialcode != ''">
        and MES_MATERIALCODE LIKE '%${mesMaterialcode}%'
      </if>
      <if test="mesProdline != null and mesProdline != ''">
        and MES_PRODLINE LIKE '%${mesProdline}%'
      </if>
      <if test="code != null and code != ''">
        and CODE LIKE '%${code}%'
      </if>
      <if test="showno != null">
        and SHOWNO = #{showno}
      </if>
      <if test="createman != null and createman != ''">
        and CREATEMAN LIKE '%${createman}%'
      </if>
      <if test="createtime != null">
        and TO_CHAR(CREATETIME,'yyyy-MM-dd') = #{createtime}
      </if>
      <if test="updateman != null and updateman != ''">
        and UPDATEMAN LIKE '%${updateman}%'
      </if>
      <if test="updatetime != null">
        and TO_CHAR(UPDATETIME,'yyyy-MM-dd') = #{updatetime}
      </if>
      <if test="itemname != null and itemname != ''">
        and ITEMNAME LIKE '%${itemname}%'
      </if>
      <if test="isfinancedata != null and isfinancedata != ''">
        and ISFINANCEDATA LIKE '%${isfinancedata}%'
      </if>
      <if test="rtpitemid != null and rtpitemid != ''">
        and RTPITEMID LIKE '%${rtpitemid}%'
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from T_RM_WORKPROC_PRODUCT
    where ITEMID = #{itemid,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from T_RM_WORKPROC_PRODUCT
    where 1!=1
    <if test="productid != null and productid != ''">
      or PRODUCTID = #{productid}
    </if>
    <if test="workprocid != null and workprocid != ''">
      or WORKPROCID = #{workprocid}
    </if>
    <if test="useflag != null and useflag != ''">
      or USEFLAG = #{useflag}
    </if>
    <if test="isprimary != null and isprimary != ''">
      or ISPRIMARY = #{isprimary}
    </if>
    <if test="itemtype != null and itemtype != ''">
      or ITEMTYPE = #{itemtype}
    </if>
    <if test="unitid != null and unitid != ''">
      or UNITID = #{unitid}
    </if>
    <if test="seqno != null and seqno != ''">
      or SEQNO = #{seqno}
    </if>
    <if test="digits != null">
      or DIGITS = #{digits}
    </if>
    <if test="mesMaterialcode != null and mesMaterialcode != ''">
      or MES_MATERIALCODE = #{mesMaterialcode}
    </if>
    <if test="mesProdline != null and mesProdline != ''">
      or MES_PRODLINE = #{mesProdline}
    </if>
    <if test="code != null and code != ''">
      or CODE = #{code}
    </if>
    <if test="showno != null">
      or SHOWNO = #{showno}
    </if>
    <if test="createman != null and createman != ''">
      or CREATEMAN = #{createman}
    </if>
    <if test="createtime != null">
      or TO_CHAR(CREATETIME,'yyyy-MM-dd') = '#{createtime}'
    </if>
    <if test="updateman != null and updateman != ''">
      or UPDATEMAN = #{updateman}
    </if>
    <if test="updatetime != null">
      or TO_CHAR(UPDATETIME,'yyyy-MM-dd') = '#{updatetime}'
    </if>
    <if test="itemname != null and itemname != ''">
      or ITEMNAME = #{itemname}
    </if>
    <if test="isfinancedata != null and isfinancedata != ''">
      or ISFINANCEDATA = #{isfinancedata}
    </if>
    <if test="rtpitemid != null and rtpitemid != ''">
      or RTPITEMID = #{rtpitemid}
    </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.ems.trmworkprocproduct.model.TRmWorkprocProduct">
    insert into T_RM_WORKPROC_PRODUCT (ITEMID, PRODUCTID, WORKPROCID,
      USEFLAG, ISPRIMARY, ITEMTYPE,
      UNITID, SEQNO, DIGITS,
      MES_MATERIALCODE, MES_PRODLINE, CODE,
      SHOWNO, CREATEMAN, CREATETIME,
      UPDATEMAN, UPDATETIME, ITEMNAME,
      ISFINANCEDATA, RTPITEMID)
    values (#{itemid,jdbcType=VARCHAR}, #{productid,jdbcType=VARCHAR}, #{workprocid,jdbcType=VARCHAR},
      #{useflag,jdbcType=VARCHAR}, #{isprimary,jdbcType=VARCHAR}, #{itemtype,jdbcType=VARCHAR},
      #{unitid,jdbcType=VARCHAR}, #{seqno,jdbcType=VARCHAR}, #{digits,jdbcType=DECIMAL},
      #{mesMaterialcode,jdbcType=VARCHAR}, #{mesProdline,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR},
      #{showno,jdbcType=DECIMAL}, #{createman,jdbcType=VARCHAR}, #{createtime,jdbcType=TIMESTAMP},
      #{updateman,jdbcType=VARCHAR}, #{updatetime,jdbcType=TIMESTAMP}, #{itemname,jdbcType=VARCHAR},
      #{isfinancedata,jdbcType=VARCHAR}, #{rtpitemid,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.ems.trmworkprocproduct.model.TRmWorkprocProduct">
    insert into T_RM_WORKPROC_PRODUCT
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="itemid != null">
        ITEMID,
      </if>
      <if test="productid != null">
        PRODUCTID,
      </if>
      <if test="workprocid != null">
        WORKPROCID,
      </if>
      <if test="useflag != null">
        USEFLAG,
      </if>
      <if test="isprimary != null">
        ISPRIMARY,
      </if>
      <if test="itemtype != null">
        ITEMTYPE,
      </if>
      <if test="unitid != null">
        UNITID,
      </if>
      <if test="seqno != null">
        SEQNO,
      </if>
      <if test="digits != null">
        DIGITS,
      </if>
      <if test="mesMaterialcode != null">
        MES_MATERIALCODE,
      </if>
      <if test="mesProdline != null">
        MES_PRODLINE,
      </if>
      <if test="code != null">
        CODE,
      </if>
      <if test="showno != null">
        SHOWNO,
      </if>
      <if test="createman != null">
        CREATEMAN,
      </if>
      <if test="createtime != null">
        CREATETIME,
      </if>
      <if test="updateman != null">
        UPDATEMAN,
      </if>
      <if test="updatetime != null">
        UPDATETIME,
      </if>
      <if test="itemname != null">
        ITEMNAME,
      </if>
      <if test="isfinancedata != null">
        ISFINANCEDATA,
      </if>
      <if test="rtpitemid != null">
        RTPITEMID,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="itemid != null">
        #{itemid,jdbcType=VARCHAR},
      </if>
      <if test="productid != null">
        #{productid,jdbcType=VARCHAR},
      </if>
      <if test="workprocid != null">
        #{workprocid,jdbcType=VARCHAR},
      </if>
      <if test="useflag != null">
        #{useflag,jdbcType=VARCHAR},
      </if>
      <if test="isprimary != null">
        #{isprimary,jdbcType=VARCHAR},
      </if>
      <if test="itemtype != null">
        #{itemtype,jdbcType=VARCHAR},
      </if>
      <if test="unitid != null">
        #{unitid,jdbcType=VARCHAR},
      </if>
      <if test="seqno != null">
        #{seqno,jdbcType=VARCHAR},
      </if>
      <if test="digits != null">
        #{digits,jdbcType=DECIMAL},
      </if>
      <if test="mesMaterialcode != null">
        #{mesMaterialcode,jdbcType=VARCHAR},
      </if>
      <if test="mesProdline != null">
        #{mesProdline,jdbcType=VARCHAR},
      </if>
      <if test="code != null">
        #{code,jdbcType=VARCHAR},
      </if>
      <if test="showno != null">
        #{showno,jdbcType=DECIMAL},
      </if>
      <if test="createman != null">
        #{createman,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null">
        #{createtime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateman != null">
        #{updateman,jdbcType=VARCHAR},
      </if>
      <if test="updatetime != null">
        #{updatetime,jdbcType=TIMESTAMP},
      </if>
      <if test="itemname != null">
        #{itemname,jdbcType=VARCHAR},
      </if>
      <if test="isfinancedata != null">
        #{isfinancedata,jdbcType=VARCHAR},
      </if>
      <if test="rtpitemid != null">
        #{rtpitemid,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.trmworkprocproduct.model.TRmWorkprocProduct">
    update T_RM_WORKPROC_PRODUCT
    set PRODUCTID = #{productid,jdbcType=VARCHAR},
      WORKPROCID = #{workprocid,jdbcType=VARCHAR},
      USEFLAG = #{useflag,jdbcType=VARCHAR},
      ISPRIMARY = #{isprimary,jdbcType=VARCHAR},
      ITEMTYPE = #{itemtype,jdbcType=VARCHAR},
      UNITID = #{unitid,jdbcType=VARCHAR},
      SEQNO = #{seqno,jdbcType=VARCHAR},
      DIGITS = #{digits,jdbcType=DECIMAL},
      MES_MATERIALCODE = #{mesMaterialcode,jdbcType=VARCHAR},
      MES_PRODLINE = #{mesProdline,jdbcType=VARCHAR},
      CODE = #{code,jdbcType=VARCHAR},
      SHOWNO = #{showno,jdbcType=DECIMAL},
      CREATEMAN = #{createman,jdbcType=VARCHAR},
      CREATETIME = #{createtime,jdbcType=TIMESTAMP},
      UPDATEMAN = #{updateman,jdbcType=VARCHAR},
      UPDATETIME = #{updatetime,jdbcType=TIMESTAMP},
      ITEMNAME = #{itemname,jdbcType=VARCHAR},
      ISFINANCEDATA = #{isfinancedata,jdbcType=VARCHAR},
      RTPITEMID = #{rtpitemid,jdbcType=VARCHAR}
    where ITEMID = #{itemid,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.trmworkprocproduct.model.TRmWorkprocProduct">
    update T_RM_WORKPROC_PRODUCT
    <set>
      <if test="productid != null">
        PRODUCTID = #{productid,jdbcType=VARCHAR},
      </if>
      <if test="workprocid != null">
        WORKPROCID = #{workprocid,jdbcType=VARCHAR},
      </if>
      <if test="useflag != null">
        USEFLAG = #{useflag,jdbcType=VARCHAR},
      </if>
      <if test="isprimary != null">
        ISPRIMARY = #{isprimary,jdbcType=VARCHAR},
      </if>
      <if test="itemtype != null">
        ITEMTYPE = #{itemtype,jdbcType=VARCHAR},
      </if>
      <if test="unitid != null">
        UNITID = #{unitid,jdbcType=VARCHAR},
      </if>
      <if test="seqno != null">
        SEQNO = #{seqno,jdbcType=VARCHAR},
      </if>
      <if test="digits != null">
        DIGITS = #{digits,jdbcType=DECIMAL},
      </if>
      <if test="mesMaterialcode != null">
        MES_MATERIALCODE = #{mesMaterialcode,jdbcType=VARCHAR},
      </if>
      <if test="mesProdline != null">
        MES_PRODLINE = #{mesProdline,jdbcType=VARCHAR},
      </if>
      <if test="code != null">
        CODE = #{code,jdbcType=VARCHAR},
      </if>
      <if test="showno != null">
        SHOWNO = #{showno,jdbcType=DECIMAL},
      </if>
      <if test="createman != null">
        CREATEMAN = #{createman,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null">
        CREATETIME = #{createtime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateman != null">
        UPDATEMAN = #{updateman,jdbcType=VARCHAR},
      </if>
      <if test="updatetime != null">
        UPDATETIME = #{updatetime,jdbcType=TIMESTAMP},
      </if>
      <if test="itemname != null">
        ITEMNAME = #{itemname,jdbcType=VARCHAR},
      </if>
      <if test="isfinancedata != null">
        ISFINANCEDATA = #{isfinancedata,jdbcType=VARCHAR},
      </if>
      <if test="rtpitemid != null">
        RTPITEMID = #{rtpitemid,jdbcType=VARCHAR},
      </if>
    </set>
    where ITEMID = #{itemid,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where ITEMID = #{itemid,jdbcType=VARCHAR}
  </select>
  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="where"/>
  </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_WORKPROC_PRODUCT
    (ITEMID,
    PRODUCTID, WORKPROCID, USEFLAG,
    ISPRIMARY, ITEMTYPE, UNITID,
    SEQNO, DIGITS, MES_MATERIALCODE,
    MES_PRODLINE, CODE, SHOWNO,
    CREATEMAN, CREATETIME, UPDATEMAN,
    UPDATETIME, ITEMNAME, ISFINANCEDATA,
    RTPITEMID)
    ( <foreach collection="list" item="item" separator="union all">
    select
    #{item.itemid,jdbcType=VARCHAR},
    #{item.productid,jdbcType=VARCHAR}, #{item.workprocid,jdbcType=VARCHAR}, #{item.useflag,jdbcType=VARCHAR},
    #{item.isprimary,jdbcType=VARCHAR}, #{item.itemtype,jdbcType=VARCHAR}, #{item.unitid,jdbcType=VARCHAR},
    #{item.seqno,jdbcType=VARCHAR}, #{item.digits,jdbcType=DECIMAL}, #{item.mesMaterialcode,jdbcType=VARCHAR},
    #{item.mesProdline,jdbcType=VARCHAR}, #{item.code,jdbcType=VARCHAR}, #{item.showno,jdbcType=DECIMAL},
    #{item.createman,jdbcType=VARCHAR}, #{item.createtime,jdbcType=TIMESTAMP}, #{item.updateman,jdbcType=VARCHAR},
    #{item.updatetime,jdbcType=TIMESTAMP}, #{item.itemname,jdbcType=VARCHAR}, #{item.isfinancedata,jdbcType=VARCHAR},
    #{item.rtpitemid,jdbcType=VARCHAR} from dual
  </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
    update T_RM_WORKPROC_PRODUCT
    set
    ITEMID=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.itemid,jdbcType=VARCHAR}
    </foreach>
    ,PRODUCTID=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.productid,jdbcType=VARCHAR}
    </foreach>
    ,WORKPROCID=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.workprocid,jdbcType=VARCHAR}
    </foreach>
    ,USEFLAG=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.useflag,jdbcType=VARCHAR}
    </foreach>
    ,ISPRIMARY=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.isprimary,jdbcType=VARCHAR}
    </foreach>
    ,ITEMTYPE=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.itemtype,jdbcType=VARCHAR}
    </foreach>
    ,UNITID=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.unitid,jdbcType=VARCHAR}
    </foreach>
    ,SEQNO=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.seqno,jdbcType=VARCHAR}
    </foreach>
    ,DIGITS=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.digits,jdbcType=DECIMAL}
    </foreach>
    ,MES_MATERIALCODE=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.mesMaterialcode,jdbcType=VARCHAR}
    </foreach>
    ,MES_PRODLINE=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.mesProdline,jdbcType=VARCHAR}
    </foreach>
    ,CODE=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.code,jdbcType=VARCHAR}
    </foreach>
    ,SHOWNO=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.showno,jdbcType=DECIMAL}
    </foreach>
    ,CREATEMAN=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.createman,jdbcType=VARCHAR}
    </foreach>
    ,CREATETIME=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.createtime,jdbcType=TIMESTAMP}
    </foreach>
    ,UPDATEMAN=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.updateman,jdbcType=VARCHAR}
    </foreach>
    ,UPDATETIME=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.updatetime,jdbcType=TIMESTAMP}
    </foreach>
    ,ITEMNAME=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.itemname,jdbcType=VARCHAR}
    </foreach>
    ,ISFINANCEDATA=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.isfinancedata,jdbcType=VARCHAR}
    </foreach>
    ,RTPITEMID=
    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
      when #{item.itemid,jdbcType=VARCHAR} then #{item.rtpitemid,jdbcType=VARCHAR}
    </foreach>
    where ITEMID in
    <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
      #{item.itemid,jdbcType=VARCHAR}
    </foreach>
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from T_RM_WORKPROC_PRODUCT
    where ITEMID in
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->
  
  <!--查询关联id-->
    <select id="getitemid" resultType="string">
        SELECT ITEMID FROM T_RM_WORKPROC_PRODUCT
    </select>

    <!--获取MES关联的id-->
    <select id="getMesItemid" parameterType="java.util.HashMap" resultMap="BaseResultMap">
      select ITEMID, PRODUCTID, WORKPROCID, USEFLAG, ISPRIMARY, ITEMTYPE, UNITID, SEQNO, CODE, DIGITS,MES_MATERIALCODE,MES_PRODLINE
        from T_RM_WORKPROC_PRODUCT
      where ITEMTYPE = #{itemtype,jdbcType=VARCHAR}
        and instr(','||MES_MATERIALCODE||',', ',${mesMaterialcode},')>0
        and instr(','||MES_PRODLINE||',', ',${mesProdline},')>0
    </select>

    <!--获取id和精度-->
    <select id="getIdAndDigits" parameterType="string" resultMap="BaseResultMap">
     SELECT ITEMID,DIGITS,ITEMTYPE,CODE,MES_MATERIALCODE,MES_PRODLINE FROM T_RM_WORKPROC_PRODUCT
     WHERE USEFLAG='1' 
     <if test="itemtype != null and itemtype != ''">
        and ITEMTYPE = #{itemtype}
     </if>
     order by code,seqno
    </select>

    <!--获取关联name-->
    <select id="getName" parameterType="string" resultType="string">
        SELECT case when substr(#{itemid},-1)='R' then a.NAME||b.NAME||'实绩产量' when substr(#{itemid},-1)='P' then a.NAME||b.NAME||'计划产量' end name
        FROM T_RM_WORKPROC a,T_RM_PRODUCT b WHERE a.ID||b.ID=substr(#{itemid},0,length(#{itemid})-1)
    </select>
</mapper>