<?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.emsprodplanround.mapper.EmsProdplanRoundMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound">
    <id column="ID" jdbcType="VARCHAR" property="id" />
    <result column="MAY" jdbcType="DATE" property="may" />
    <result column="SQNO" jdbcType="DECIMAL" property="sqno" />
    <result column="UNITID" jdbcType="VARCHAR" property="unitid" />
    <result column="DESCRIBE" jdbcType="VARCHAR" property="describe" />
    <result column="STATE" jdbcType="VARCHAR" property="state" />
    <result column="GRADES" jdbcType="VARCHAR" property="grades" />
    <result column="PLAN_WEIGHT" jdbcType="DECIMAL" property="planWeight" />
    <result column="SPECIFICATIONS" jdbcType="VARCHAR" property="specifications" />
    <result column="LENGTHS" jdbcType="VARCHAR" property="lengths" />
    <result column="CHEMICAL_STANDARD" jdbcType="VARCHAR" property="chemicalStandard" />
    <result column="SURFACE_STANDARD" jdbcType="VARCHAR" property="surfaceStandard" />
    <result column="MEMO" jdbcType="VARCHAR" property="memo" />
    <result column="ISSUED_TIME" jdbcType="TIMESTAMP" property="issuedTime" />
    <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="TRANSPORT_TYPE" jdbcType="VARCHAR" property="transportType" />
    <result column="PURPOSE" jdbcType="VARCHAR" property="purpose" />
    <result column="WORKPROC_TYPE" jdbcType="VARCHAR" property="workprocType" />
    <result column="MSG_FLAG" jdbcType="VARCHAR" property="msgFlag" />
    <result column="READ_FLAG" jdbcType="VARCHAR" property="readFlag" />
    <result column="PARENTID" jdbcType="VARCHAR" property="parentid"/>
    <result column="IATERAL_AREA" jdbcType="VARCHAR" property="iateralArea"/>
    <result column="LENGTH_TIMES_WIDTH" jdbcType="VARCHAR" property="lengthTimesWidth"/>
    <result column="DIMENSION" jdbcType="VARCHAR" property="dimension"/>
    <result column="STATUS" jdbcType="VARCHAR" property="status"/>
    <result column="ERR_MSG" jdbcType="VARCHAR" property="err_msg"/>
    <result column="DELIVERY_DATE" jdbcType="TIMESTAMP" property="deliveryDate"/>
    <result column="AUDITSTATE" jdbcType="VARCHAR" property="auditState"/>
    <result column="GOINFO" jdbcType="VARCHAR" property="goinfo"/>
    <result column="FETCH_PLAN_WEIGHT" jdbcType="DECIMAL" property="fetchPlanWeight"/>
    <result column="ASCRIPTION" jdbcType="VARCHAR" property="ascription"/>
    <result column="TAG" jdbcType="VARCHAR" property="tag"/>
  </resultMap>
  <sql id="columns">
    ID, MAY, SQNO, UNITID, DESCRIBE, STATE, GRADES, PLAN_WEIGHT, SPECIFICATIONS, LENGTHS, 
    CHEMICAL_STANDARD, SURFACE_STANDARD, MEMO, ISSUED_TIME, CREATEMAN, CREATETIME, UPDATEMAN, 
    UPDATETIME, TRANSPORT_TYPE, PURPOSE, WORKPROC_TYPE, MSG_FLAG, READ_FLAG,PARENTID,IATERAL_AREA,LENGTH_TIMES_WIDTH,DIMENSION,STATUS,ERR_MSG,GOINFO,FETCH_PLAN_WEIGHT,DELIVERY_DATE,AUDITSTATE,ASCRIPTION,TAG
  </sql>
  <sql id="columns_alias">
    t.ID, t.MAY, t.SQNO, t.UNITID, t.DESCRIBE, t.STATE, t.GRADES, t.PLAN_WEIGHT, t.SPECIFICATIONS, 
    t.LENGTHS, t.CHEMICAL_STANDARD, t.SURFACE_STANDARD, t.MEMO, t.ISSUED_TIME, t.CREATEMAN, 
    t.CREATETIME, t.UPDATEMAN, t.UPDATETIME, t.TRANSPORT_TYPE, t.PURPOSE, t.WORKPROC_TYPE, 
    t.MSG_FLAG, t.READ_FLAG,t.PARENTID,GOINFO,FETCH_PLAN_WEIGHT,t.TAG
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM EMS_PRODPLAN_ROUND
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM EMS_PRODPLAN_ROUND t
  </sql>
  <sql id="where">
    <where> 
      <if test="id != null and id != ''">
        and ID = #{id}
      </if>
      <if test="may != null">
        and  trunc(MAY) = to_date(#{may},'yyyy-mm-dd')
      </if>
      <if test="sqno != null and sqno != ''">
        and SQNO = #{sqno}
      </if>
      <if test="unitid != null and unitid != ''">
        and UNITID = #{unitid}
      </if>
      <if test="describe != null and describe != ''">
        and DESCRIBE = #{describe}
      </if>
      <if test="state != null and state != ''">
        and STATE = #{state}
      </if>
      <if test="grades != null and grades != ''">
        and GRADES = #{grades}
      </if>
      <if test="planWeight != null">
        and PLAN_WEIGHT = #{planWeight}
      </if>
      <if test="specifications != null and specifications != ''">
        and SPECIFICATIONS = #{specifications}
      </if>
      <if test="lengths != null and lengths != ''">
        and LENGTHS = #{lengths}
      </if>
      <if test="chemicalStandard != null and chemicalStandard != ''">
        and CHEMICAL_STANDARD = #{chemicalStandard}
      </if>
      <if test="surfaceStandard != null and surfaceStandard != ''">
        and SURFACE_STANDARD = #{surfaceStandard}
      </if>
      <if test="memo != null and memo != ''">
        and MEMO = #{memo}
      </if>
      <if test="issuedTime != null">
        and TO_CHAR(ISSUED_TIME,'yyyy-MM-dd') = #{issuedTime}
      </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="transportType != null and transportType != ''">
        and TRANSPORT_TYPE = #{transportType}
      </if>
      <if test="purpose != null and purpose != ''">
        and PURPOSE = #{purpose}
      </if>
      <if test="workprocType != null and workprocType != ''">
        and WORKPROC_TYPE = #{workprocType}
      </if>
      <if test="msgFlag != null and msgFlag != ''">
        and MSG_FLAG = #{msgFlag}
      </if>
      <if test="readFlag != null and readFlag != ''">
        and READ_FLAG = #{readFlag}
      </if>
      <if test="parentid != null and parentid != '' ">
        and PARENTID = #{parentid}
      </if>
      <if test="tag != null and tag != '' ">
        and TAG = #{tag}
      </if>
      ORDER BY CREATETIME DESC
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <if test="id != null and id != ''">
        and ID LIKE '%${id}%'
      </if>
      <if test="may != null">
        and TO_CHAR(MAY,'yyyy-MM-dd') = #{may}
      </if>
      <if test="sqno != null and sqno != ''">
        and SQNO LIKE '%${sqno}%'
      </if>
      <if test="unitid != null and unitid != ''">
        and UNITID LIKE '%${unitid}%'
      </if>
      <if test="describe != null and describe != ''">
        and DESCRIBE LIKE '%${describe}%'
      </if>
      <if test="state != null and state != ''">
        and STATE LIKE '%${state}%'
      </if>
      <if test="grades != null and grades != ''">
        and GRADES LIKE '%${grades}%'
      </if>
      <if test="planWeight != null">
        and PLAN_WEIGHT = #{planWeight}
      </if>
      <if test="specifications != null and specifications != ''">
        and SPECIFICATIONS LIKE '%${specifications}%'
      </if>
      <if test="lengths != null and lengths != ''">
        and LENGTHS LIKE '%${lengths}%'
      </if>
      <if test="chemicalStandard != null and chemicalStandard != ''">
        and CHEMICAL_STANDARD LIKE '%${chemicalStandard}%'
      </if>
      <if test="surfaceStandard != null and surfaceStandard != ''">
        and SURFACE_STANDARD LIKE '%${surfaceStandard}%'
      </if>
      <if test="memo != null and memo != ''">
        and MEMO LIKE '%${memo}%'
      </if>
      <if test="issuedTime != null">
        and TO_CHAR(ISSUED_TIME,'yyyy-MM-dd') = #{issuedTime}
      </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="transportType != null and transportType != ''">
        and TRANSPORT_TYPE LIKE '%${transportType}%'
      </if>
      <if test="purpose != null and purpose != ''">
        and PURPOSE LIKE '%${purpose}%'
      </if>
      <if test="workprocType != null and workprocType != ''">
        and WORKPROC_TYPE LIKE '%${workprocType}%'
      </if>
      <if test="msgFlag != null and msgFlag != ''">
        and MSG_FLAG LIKE '%${msgFlag}%'
      </if>
      <if test="readFlag != null and readFlag != ''">
        and READ_FLAG LIKE '%${readFlag}%'
      </if>
      <if test="tag != null and tag != ''">
        and TAG LIKE '%${tag}%'
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from EMS_PRODPLAN_ROUND
    where ID = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from EMS_PRODPLAN_ROUND
    where 1!=1 
      <if test="may != null">
        or TO_CHAR(MAY,'yyyy-MM-dd') = '#{may}'
      </if>
      <if test="sqno != null and sqno != ''">
        or SQNO = #{sqno}
      </if>
      <if test="unitid != null and unitid != ''">
        or UNITID = #{unitid}
      </if>
      <if test="describe != null and describe != ''">
        or DESCRIBE = #{describe}
      </if>
      <if test="state != null and state != ''">
        or STATE = #{state}
      </if>
      <if test="grades != null and grades != ''">
        or GRADES = #{grades}
      </if>
      <if test="planWeight != null">
        or PLAN_WEIGHT = #{planWeight}
      </if>
      <if test="specifications != null and specifications != ''">
        or SPECIFICATIONS = #{specifications}
      </if>
      <if test="lengths != null and lengths != ''">
        or LENGTHS = #{lengths}
      </if>
      <if test="chemicalStandard != null and chemicalStandard != ''">
        or CHEMICAL_STANDARD = #{chemicalStandard}
      </if>
      <if test="surfaceStandard != null and surfaceStandard != ''">
        or SURFACE_STANDARD = #{surfaceStandard}
      </if>
      <if test="memo != null and memo != ''">
        or MEMO = #{memo}
      </if>
      <if test="issuedTime != null">
        or TO_CHAR(ISSUED_TIME,'yyyy-MM-dd') = '#{issuedTime}'
      </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="transportType != null and transportType != ''">
        or TRANSPORT_TYPE = #{transportType}
      </if>
      <if test="purpose != null and purpose != ''">
        or PURPOSE = #{purpose}
      </if>
      <if test="workprocType != null and workprocType != ''">
        or WORKPROC_TYPE = #{workprocType}
      </if>
      <if test="msgFlag != null and msgFlag != ''">
        or MSG_FLAG = #{msgFlag}
      </if>
      <if test="readFlag != null and readFlag != ''">
        or READ_FLAG = #{readFlag}
      </if>
    <if test="tag != null and tag != ''">
      or TAG = #{tag}
    </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound">
    insert into EMS_PRODPLAN_ROUND (ID, MAY, SQNO, 
      UNITID, DESCRIBE, STATE, 
      GRADES, PLAN_WEIGHT, SPECIFICATIONS, 
      LENGTHS, CHEMICAL_STANDARD, SURFACE_STANDARD, 
      MEMO, ISSUED_TIME, CREATEMAN, 
      CREATETIME, UPDATEMAN, UPDATETIME, 
      TRANSPORT_TYPE, PURPOSE, WORKPROC_TYPE,
      MSG_FLAG, READ_FLAG,PARENTID,IATERAL_AREA,LENGTH_TIMES_WIDTH,DIMENSION,GOINFO,DELIVERY_DATE,AUDITSTATE,ASCRIPTION,TAG)
    values (#{id,jdbcType=VARCHAR}, #{may,jdbcType=TIMESTAMP}, #{sqno,jdbcType=DECIMAL},
      #{unitid,jdbcType=VARCHAR}, #{describe,jdbcType=VARCHAR}, #{state,jdbcType=VARCHAR}, 
      #{grades,jdbcType=VARCHAR}, #{planWeight,jdbcType=DECIMAL}, #{specifications,jdbcType=VARCHAR}, 
      #{lengths,jdbcType=VARCHAR}, #{chemicalStandard,jdbcType=VARCHAR}, #{surfaceStandard,jdbcType=VARCHAR}, 
      #{memo,jdbcType=VARCHAR}, #{issuedTime,jdbcType=TIMESTAMP}, #{createman,jdbcType=VARCHAR}, 
      #{createtime,jdbcType=TIMESTAMP}, #{updateman,jdbcType=VARCHAR}, #{updatetime,jdbcType=TIMESTAMP}, 
      #{transportType,jdbcType=VARCHAR}, #{purpose,jdbcType=VARCHAR}, #{workprocType,jdbcType=VARCHAR}, 
      #{msgFlag,jdbcType=VARCHAR}, #{readFlag,jdbcType=VARCHAR},#{parentid,jdbcType=VARCHAR},
      #{iateralArea,jdbcType=VARCHAR},#{lengthTimesWidth,jdbcType=VARCHAR},
      #{dimension,jdbcType=VARCHAR},#{goinfo,jdbcType=VARCHAR},
      #{deliveryDate,jdbcType=TIMESTAMP},#{auditState,jdbcType=VARCHAR},#{ascription,jdbcType=VARCHAR},#{tag,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound">
    insert into EMS_PRODPLAN_ROUND
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        ID,
      </if>
      <if test="may != null">
        MAY,
      </if>
      <if test="sqno != null">
        SQNO,
      </if>
      <if test="unitid != null">
        UNITID,
      </if>
      <if test="describe != null">
        DESCRIBE,
      </if>
      <if test="state != null">
        STATE,
      </if>
      <if test="grades != null">
        GRADES,
      </if>
      <if test="planWeight != null">
        PLAN_WEIGHT,
      </if>
      <if test="specifications != null">
        SPECIFICATIONS,
      </if>
      <if test="lengths != null">
        LENGTHS,
      </if>
      <if test="chemicalStandard != null">
        CHEMICAL_STANDARD,
      </if>
      <if test="surfaceStandard != null">
        SURFACE_STANDARD,
      </if>
      <if test="memo != null">
        MEMO,
      </if>
      <if test="issuedTime != null">
        ISSUED_TIME,
      </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="transportType != null">
        TRANSPORT_TYPE,
      </if>
      <if test="purpose != null">
        PURPOSE,
      </if>
      <if test="workprocType != null">
        WORKPROC_TYPE,
      </if>
      <if test="msgFlag != null">
        MSG_FLAG,
      </if>
      <if test="readFlag != null">
        READ_FLAG,
      </if>
      <if test="tag != null">
        TAG,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="may != null">
        #{may,jdbcType=TIMESTAMP},
      </if>
      <if test="sqno != null">
        #{sqno,jdbcType=DECIMAL},
      </if>
      <if test="unitid != null">
        #{unitid,jdbcType=VARCHAR},
      </if>
      <if test="describe != null">
        #{describe,jdbcType=VARCHAR},
      </if>
      <if test="state != null">
        #{state,jdbcType=VARCHAR},
      </if>
      <if test="grades != null">
        #{grades,jdbcType=VARCHAR},
      </if>
      <if test="planWeight != null">
        #{planWeight,jdbcType=DECIMAL},
      </if>
      <if test="specifications != null">
        #{specifications,jdbcType=VARCHAR},
      </if>
      <if test="lengths != null">
        #{lengths,jdbcType=VARCHAR},
      </if>
      <if test="chemicalStandard != null">
        #{chemicalStandard,jdbcType=VARCHAR},
      </if>
      <if test="surfaceStandard != null">
        #{surfaceStandard,jdbcType=VARCHAR},
      </if>
      <if test="memo != null">
        #{memo,jdbcType=VARCHAR},
      </if>
      <if test="issuedTime != null">
        #{issuedTime,jdbcType=TIMESTAMP},
      </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="transportType != null">
        #{transportType,jdbcType=VARCHAR},
      </if>
      <if test="purpose != null">
        #{purpose,jdbcType=VARCHAR},
      </if>
      <if test="workprocType != null">
        #{workprocType,jdbcType=VARCHAR},
      </if>
      <if test="msgFlag != null">
        #{msgFlag,jdbcType=VARCHAR},
      </if>
      <if test="readFlag != null">
        #{readFlag,jdbcType=VARCHAR},
      </if>
      <if test="goinfo != null and goinfo ! = ''">
        #{goinfo,jdbcType=VARCHAR}
      </if>
      <if test="fetchPlanWeight != null ">
        #{fetchPlanWeight,jdbcType=DECIMAL}
      </if>
      <if test="tag != null ">
        #{tag,jdbcType=VARCHAR}
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound">
    update EMS_PRODPLAN_ROUND
    set MAY = #{may,jdbcType=TIMESTAMP},
      SQNO = #{sqno,jdbcType=DECIMAL},
      UNITID = #{unitid,jdbcType=VARCHAR},
      DESCRIBE = #{describe,jdbcType=VARCHAR},
      STATE = #{state,jdbcType=VARCHAR},
      GRADES = #{grades,jdbcType=VARCHAR},
      PLAN_WEIGHT = #{planWeight,jdbcType=DECIMAL},
      SPECIFICATIONS = #{specifications,jdbcType=VARCHAR},
      LENGTHS = #{lengths,jdbcType=VARCHAR},
      CHEMICAL_STANDARD = #{chemicalStandard,jdbcType=VARCHAR},
      SURFACE_STANDARD = #{surfaceStandard,jdbcType=VARCHAR},
      MEMO = #{memo,jdbcType=VARCHAR},
      ISSUED_TIME = #{issuedTime,jdbcType=TIMESTAMP},
      CREATEMAN = #{createman,jdbcType=VARCHAR},
      CREATETIME = #{createtime,jdbcType=TIMESTAMP},
      UPDATEMAN = #{updateman,jdbcType=VARCHAR},
      UPDATETIME = #{updatetime,jdbcType=TIMESTAMP},
      TRANSPORT_TYPE = #{transportType,jdbcType=VARCHAR},
      PURPOSE = #{purpose,jdbcType=VARCHAR},
      WORKPROC_TYPE = #{workprocType,jdbcType=VARCHAR},
      PARENTID = #{parentid,jdbcType=VARCHAR},
      IATERAL_AREA = #{iateralArea,jdbcType=VARCHAR},
      LENGTH_TIMES_WIDTH = #{lengthTimesWidth,jdbcType=VARCHAR},
      DIMENSION = #{dimension,jdbcType=VARCHAR},
      GOINFO = #{goinfo,jdbcType=VARCHAR},
    TAG = #{tag,jdbcType=VARCHAR}
    where ID = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound">
    update EMS_PRODPLAN_ROUND
    <set>
      <if test="may != null">
        MAY = #{may,jdbcType=TIMESTAMP},
      </if>
      <if test="sqno != null">
        SQNO = #{sqno,jdbcType=DECIMAL},
      </if>
      <if test="unitid != null">
        UNITID = #{unitid,jdbcType=VARCHAR},
      </if>
      <if test="describe != null">
        DESCRIBE = #{describe,jdbcType=VARCHAR},
      </if>
      <if test="state != null">
        STATE = #{state,jdbcType=VARCHAR},
      </if>
      <if test="grades != null">
        GRADES = #{grades,jdbcType=VARCHAR},
      </if>
      <if test="planWeight != null">
        PLAN_WEIGHT = #{planWeight,jdbcType=DECIMAL},
      </if>
      <if test="specifications != null">
        SPECIFICATIONS = #{specifications,jdbcType=VARCHAR},
      </if>
      <if test="lengths != null">
        LENGTHS = #{lengths,jdbcType=VARCHAR},
      </if>
      <if test="chemicalStandard != null">
        CHEMICAL_STANDARD = #{chemicalStandard,jdbcType=VARCHAR},
      </if>
      <if test="surfaceStandard != null">
        SURFACE_STANDARD = #{surfaceStandard,jdbcType=VARCHAR},
      </if>
      <if test="memo != null">
        MEMO = #{memo,jdbcType=VARCHAR},
      </if>
      <if test="issuedTime != null">
        ISSUED_TIME = #{issuedTime,jdbcType=TIMESTAMP},
      </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="transportType != null">
        TRANSPORT_TYPE = #{transportType,jdbcType=VARCHAR},
      </if>
      <if test="purpose != null">
        PURPOSE = #{purpose,jdbcType=VARCHAR},
      </if>
      <if test="workprocType != null">
        WORKPROC_TYPE = #{workprocType,jdbcType=VARCHAR},
      </if>
      <if test="msgFlag != null">
        MSG_FLAG = #{msgFlag,jdbcType=VARCHAR},
      </if>
      <if test="readFlag != null">
        READ_FLAG = #{readFlag,jdbcType=VARCHAR},
      </if>
      <if test="parentid != null and parentid != ''">
       PARENTID = #{parentid,jdbcType=VARCHAR},
      </if>
      <if test="iateralArea != null and iateralArea != ''">
        IATERAL_AREA = #{iateralArea,jdbcType=VARCHAR},
      </if>
      <if test="lengthTimesWidth != null and lengthTimesWidth != ''">
        LENGTH_TIMES_WIDTH = #{lengthTimesWidth,jdbcType=VARCHAR},
      </if>
      <if test="dimension != null and dimension != ''">
        DIMENSION = #{dimension,jdbcType=VARCHAR},
      </if>
      <if test="goinfo != null and goinfo != ''">
        GOINFO = #{goinfo,jdbcType=VARCHAR},
      </if>
      <if test="tag != null and tag != ''">
        TAG = #{tag,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"/>
  </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 EMS_PRODPLAN_ROUND 
      (ID, 
      MAY, SQNO, UNITID, 
      DESCRIBE, STATE, GRADES, 
      PLAN_WEIGHT, SPECIFICATIONS, LENGTHS, 
      CHEMICAL_STANDARD, SURFACE_STANDARD, 
      MEMO, ISSUED_TIME, CREATEMAN, 
      CREATETIME, UPDATEMAN, UPDATETIME, 
      TRANSPORT_TYPE, PURPOSE, WORKPROC_TYPE, 
      MSG_FLAG, READ_FLAG,TAG)
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.id,jdbcType=VARCHAR}, 
      #{item.may,jdbcType=TIMESTAMP}, #{item.sqno,jdbcType=DECIMAL}, #{item.unitid,jdbcType=VARCHAR},
      #{item.describe,jdbcType=VARCHAR}, #{item.state,jdbcType=VARCHAR}, #{item.grades,jdbcType=VARCHAR}, 
      #{item.planWeight,jdbcType=DECIMAL}, #{item.specifications,jdbcType=VARCHAR}, #{item.lengths,jdbcType=VARCHAR}, 
      #{item.chemicalStandard,jdbcType=VARCHAR}, #{item.surfaceStandard,jdbcType=VARCHAR}, 
      #{item.memo,jdbcType=VARCHAR}, #{item.issuedTime,jdbcType=TIMESTAMP}, #{item.createman,jdbcType=VARCHAR}, 
      #{item.createtime,jdbcType=TIMESTAMP}, #{item.updateman,jdbcType=VARCHAR}, #{item.updatetime,jdbcType=TIMESTAMP}, 
      #{item.transportType,jdbcType=VARCHAR}, #{item.purpose,jdbcType=VARCHAR}, #{item.workprocType,jdbcType=VARCHAR}, 
      #{item.msgFlag,jdbcType=VARCHAR}, #{item.readFlag,jdbcType=VARCHAR}, #{item.tag,jdbcType=VARCHAR} from dual
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update EMS_PRODPLAN_ROUND
     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>
       ,MAY=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.may,jdbcType=TIMESTAMP}
       </foreach>
       ,SQNO=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.sqno,jdbcType=DECIMAL}
       </foreach>
       ,UNITID=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.unitid,jdbcType=VARCHAR}
       </foreach>
       ,DESCRIBE=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.describe,jdbcType=VARCHAR}
       </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>
       ,GRADES=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.grades,jdbcType=VARCHAR}
       </foreach>
       ,PLAN_WEIGHT=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.planWeight,jdbcType=DECIMAL}
       </foreach>
       ,SPECIFICATIONS=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.specifications,jdbcType=VARCHAR}
       </foreach>
       ,LENGTHS=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.lengths,jdbcType=VARCHAR}
       </foreach>
       ,CHEMICAL_STANDARD=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.chemicalStandard,jdbcType=VARCHAR}
       </foreach>
       ,SURFACE_STANDARD=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.surfaceStandard,jdbcType=VARCHAR}
       </foreach>
       ,MEMO=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.memo,jdbcType=VARCHAR}
       </foreach>
       ,ISSUED_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.issuedTime,jdbcType=TIMESTAMP}
       </foreach>
       ,CREATEMAN=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.createman,jdbcType=VARCHAR}
       </foreach>
       ,CREATETIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.createtime,jdbcType=TIMESTAMP}
       </foreach>
       ,UPDATEMAN=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.updateman,jdbcType=VARCHAR}
       </foreach>
       ,UPDATETIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.updatetime,jdbcType=TIMESTAMP}
       </foreach>
       ,TRANSPORT_TYPE=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.transportType,jdbcType=VARCHAR}
       </foreach>
       ,PURPOSE=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.purpose,jdbcType=VARCHAR}
       </foreach>
       ,WORKPROC_TYPE=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.workprocType,jdbcType=VARCHAR}
       </foreach>
       ,MSG_FLAG=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.msgFlag,jdbcType=VARCHAR}
       </foreach>
       ,READ_FLAG=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.readFlag,jdbcType=VARCHAR}
       </foreach>
    ,TAG=
    <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
      when #{item.id,jdbcType=VARCHAR} then #{item.tag,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 EMS_PRODPLAN_ROUND
    where ID in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->
  <!--获取超出重量-->
  <!--获取超出重量-->
  <select id="getbeyondWeight" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    select  nvl(sum(t.plan_weight),0) plan_weight from EMS_PRODPLAN_ROUND t
     <where>
       <if test="parentid != null and parentid !='' ">
        and t.parentid = #{parentid}
       </if>
       <if test="may != null ">
         and   trunc(t.may) = to_date(#{may},'yyyy-mm-dd')
       </if>
     </where>
  </select>
  <select id="getSumPlanWeight" parameterType="java.lang.String"  resultMap="BaseResultMap">
    select  nvl(sum(t.plan_weight),0) plan_weight from EMS_PRODPLAN_ROUND t  where id = #{id}
<!--    parameterType="java.util.List" t.id in-->
<!--     <foreach collection="list" item="id" open="(" close=")" separator=",">-->
<!--       #{id}-->
<!--     </foreach>-->
  </select>
  <select id="getMaxidAsGm" parameterType="com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound" resultType="java.lang.String">
      select #{parentid} || '-' || to_char(nvl(max(substr(ID, 18, 2) + 1), 1),'fm00') as id
      from ems_prodplan_round
      where
      parentid = #{parentid}
      AND ID like
      '%'||(SELECT  'G-' || substr(#{parentid}, 3) FROM dual)||'%'
  </select>
  <select id="getMaxidAsSC" parameterType="com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound" resultType="java.lang.String">
    SELECT 'N-' || substr(#{parentid}, 3) ||'-'||
         to_char(nvl(max(substr(ID, 18, 2) + 1), 1),'fm00') AS ID
    FROM ems_prodplan_round
    where
    ID LIKE
    '%'||(SELECT  'N-' || substr(#{parentid}, 3) FROM dual )||'%'
  </select>
  <select id="getbasespecbillet" resultMap="BaseResultMap">
       select distinct SPECIFICATIONS  from ems_gm_pc_jh
           where SPECIFICATIONS not like '%null%'
           and WORKPROC_TYPE = 'AT2007'
  </select>
  <!---->
  <select id="getiateralArea" resultMap="BaseResultMap">
    select distinct IATERAL_AREA from ems_prodplan_round
           where IATERAL_AREA not like '%null%'
  </select>
  <!---->
  <select id="getdimension" resultMap="BaseResultMap">
    select distinct dimension from ems_prodplan_round
           where dimension not like '%null%'
  </select>
  <!---->
  <select id="getsurfaceStandard" resultMap="BaseResultMap">
    select distinct SURFACE_STANDARD
             from ems_prodplan_round
            where SURFACE_STANDARD not like '%null%'
  </select>
  <!---->
  <select id="getAuditDate" parameterType="java.util.HashMap"  resultMap="BaseResultMap">
    <include refid="select"/>
    <where>
      <if test="workprocType != null and workprocType != '' ">
       and WORKPROC_TYPE = #{workprocType}
      </if>
      <if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
        and MAY BETWEEN  to_date(#{startTime},'yyyy-mm-dd') and to_date(#{endTime},'yyyy-mm-dd')
      </if>
        and AUDITSTATE in ('1','2','3')
    </where>
  </select>
  <!---->
  <select id="updateAuditState" parameterType="com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound" resultType="Integer">
    UPDATE ems_prodplan_round
    <set>
      <if test="auditState != null and auditState != '' ">
        AUDITSTATE = #{auditState}
      </if>
    </set>
    <where>
      <if test="id != null and id != '' ">
        ID = #{id}
      </if>
    </where>
  </select>
  <!---->
  <select id="getRounds" parameterType="com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound" resultMap="BaseResultMap">
    <include refid="select"/>
    <where>
      <if test="parentid != null and parentid != '' ">
       and  parentid =#{parentid}
      </if>
      and  id like '%G-%'
    </where>
  </select>
  <select id="getchemicalStandard" resultMap="BaseResultMap">
    select distinct CHEMICAL_STANDARD
    from ems_prodplan_round
   where CHEMICAL_STANDARD not like '%null%'
  </select>
   <select id="getTableDetailAsRadio" parameterType="java.util.HashMap" resultMap="BaseResultMap">
     <include refid="select"/>
     <where>
       <if test="id != null and id != '' ">
         and PARENTID in (${id})
       </if>
       <if test="state != null and state != '' ">
         and STATE != #{state}
       </if>
     </where>
     order by state
   </select>
  <select id="getLastIssuedData" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    SELECT * FROM (<include refid="select"/>
    WHERE ISSUED_TIME is not null AND STATE IN ('1','2') AND WORKPROC_TYPE=#{workprocType} AND ID LIKE '${id}%'  ORDER BY ISSUED_TIME desc)
    WHERE rownum=1
  </select>
</mapper>