<?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.emsgmpcjh.mapper.EmsGmPcJhMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.ems.emsgmpcjh.model.EmsGmPcJh">
    <id column="ID" jdbcType="VARCHAR" property="id" />
    <result column="JH_TIME" jdbcType="DATE" property="jhTime" />
    <result column="STATE" jdbcType="VARCHAR" property="state" />
    <result column="GRADES" jdbcType="VARCHAR" property="grades" />
    <result column="SPECIFICATIONS" jdbcType="VARCHAR" property="specifications" />
    <result column="LENGTHS" jdbcType="DECIMAL" property="lengths" />
    <result column="CHEMICAL_STANDARD" jdbcType="VARCHAR" property="chemicalStandard" />
    <result column="SURFACE_STANDARD" jdbcType="VARCHAR" property="surfaceStandard" />
    <result column="WORKPROC_TYPE" jdbcType="VARCHAR" property="workprocType" />
    <result column="IATERAL_AREA" jdbcType="VARCHAR" property="iateralArea" />
    <result column="LENGTH_TIMES_WIDTH" jdbcType="VARCHAR" property="lengthTimesWidth" />
    <result column="TRANSPORT_TYPE" jdbcType="VARCHAR" property="transportType" />
    <result column="RECEIVE_TIME" jdbcType="TIMESTAMP" property="receiveTime" />
    <result column="CREATE_MAN" jdbcType="VARCHAR" property="createMan" />
    <result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" />
    <result column="GM_REVIEWER" jdbcType="VARCHAR" property="gmReviewer"/>
    <result column="GM_REVIEWER_TIME" jdbcType="TIMESTAMP" property="gmReviewerTime"/>
    <result column="UPDATE_MAN" jdbcType="VARCHAR" property="updateMan" />
    <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="MEMO" jdbcType="VARCHAR" property="memo" />
    <result column="PURPOSE" jdbcType="VARCHAR" property="purpose" />
    <result column="UNITID" jdbcType="VARCHAR" property="unitid" />
    <result column="DIMENSION" jdbcType="VARCHAR" property="dimension" />
    <result column="KXF_WEIGHT" jdbcType="DECIMAL" property="kxfWeight" />
    <result column="YXF_WEIGHT" jdbcType="DECIMAL" property="yxfWeight" />
    <result column="DELIVERY_DATE" jdbcType="TIMESTAMP" property="deliveryDate"/>
    <result column="PLAN_WEIGHT" jdbcType="DECIMAL" property="planWeight" />
    <result column="TAG" jdbcType="VARCHAR" property="tag" />
  </resultMap>
  <sql id="columns">
    ID, JH_TIME, STATE, GRADES, SPECIFICATIONS, LENGTHS, CHEMICAL_STANDARD, SURFACE_STANDARD, 
    WORKPROC_TYPE, IATERAL_AREA, LENGTH_TIMES_WIDTH, TRANSPORT_TYPE, RECEIVE_TIME, CREATE_MAN, 
    CREATE_TIME, UPDATE_MAN, UPDATE_TIME, MEMO, PURPOSE, UNITID, DIMENSION, KXF_WEIGHT, DELIVERY_DATE,
    YXF_WEIGHT, PLAN_WEIGHT,GM_REVIEWER,GM_REVIEWER_TIME,TAG
  </sql>
  <sql id="columns_alias">
    t.ID, t.JH_TIME, t.STATE, t.GRADES, t.SPECIFICATIONS, t.LENGTHS, t.CHEMICAL_STANDARD, 
    t.SURFACE_STANDARD, t.WORKPROC_TYPE, t.IATERAL_AREA, t.LENGTH_TIMES_WIDTH, t.TRANSPORT_TYPE, 
    t.RECEIVE_TIME, t.CREATE_MAN, t.CREATE_TIME, t.UPDATE_MAN, t.UPDATE_TIME, t.MEMO, 
    t.PURPOSE, t.UNITID, t.DIMENSION, t.KXF_WEIGHT, t.YXF_WEIGHT, t.PLAN_WEIGHT, t.TAG
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM EMS_GM_PC_JH
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM EMS_GM_PC_JH t
  </sql>
  <sql id="where">
    <where>
      <if test="state != null and state != ''">
        and STATE = #{state}
      </if>
      <if test="grades != null and grades != ''">
        and GRADES in (${grades})
      </if>
      <if test="specifications != null and specifications != ''">
        and SPECIFICATIONS in (${specifications})
      </if>
      <if test="lengths != null">
        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="workprocType != null and workprocType != ''">
        and WORKPROC_TYPE = #{workprocType}
      </if>
      <if test="iateralArea != null and iateralArea != ''">
        and IATERAL_AREA = #{iateralArea}
      </if>
      <if test="lengthTimesWidth != null and lengthTimesWidth != ''">
        and LENGTH_TIMES_WIDTH in (${lengthTimesWidth})
      </if>
      <if test="transportType != null and transportType != ''">
        and TRANSPORT_TYPE = #{transportType}
      </if>
      <if test="receiveTime != null">
        and TO_CHAR(RECEIVE_TIME,'yyyy-MM-dd') = #{receiveTime}
      </if>
      <if test="createMan != null and createMan != ''">
        and CREATE_MAN = #{createMan}
      </if>
      <if test="createTime != null">
        and TO_CHAR(CREATE_TIME,'yyyy-MM-dd') = #{createTime}
      </if>
      <if test="updateMan != null and updateMan != ''">
        and UPDATE_MAN = #{updateMan}
      </if>
      <if test="updateTime != null">
        and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
      </if>
      <if test="memo != null and memo != ''">
        and MEMO = #{memo}
      </if>
      <if test="purpose != null and purpose != ''">
        and PURPOSE = #{purpose}
      </if>
      <if test="unitid != null and unitid != ''">
        and UNITID = #{unitid}
      </if>
      <if test="dimension != null and dimension != ''">
        and DIMENSION = #{dimension}
      </if>
      <if test="kxfWeight != null">
        and KXF_WEIGHT = #{kxfWeight}
      </if>
      <if test="yxfWeight != null">
        and YXF_WEIGHT = #{yxfWeight}
      </if>
      <if test="planWeight != null">
        and PLAN_WEIGHT = #{planWeight}
      </if>
      <if test="startTime != null and startTime !='' and endTime != null and endTime != ''">
        and JH_TIME BETWEEN TO_DATE(#{startTime},'yyyy-mm-dd') AND TO_DATE(#{endTime}，'yyyy-mm-dd')
      </if>
      <if test="tag != null and tag != ''">
        and TAG = #{tag}
      </if>
      AND ID like '%G-%'
      order by  JH_TIME desc, ID asc
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <if test="id != null and id != ''">
        and ID LIKE '%${id}%'
      </if>
      <if test="jhTime != null">
        and TO_CHAR(JH_TIME,'yyyy-MM-dd') = #{jhTime}
      </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="specifications != null and specifications != ''">
        and SPECIFICATIONS LIKE '%${specifications}%'
      </if>
      <if test="lengths != null">
        and LENGTHS = #{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="workprocType != null and workprocType != ''">
        and WORKPROC_TYPE LIKE '%${workprocType}%'
      </if>
      <if test="iateralArea != null and iateralArea != ''">
        and IATERAL_AREA LIKE '%${iateralArea}%'
      </if>
      <if test="lengthTimesWidth != null and lengthTimesWidth != ''">
        and LENGTH_TIMES_WIDTH LIKE '%${lengthTimesWidth}%'
      </if>
      <if test="transportType != null and transportType != ''">
        and TRANSPORT_TYPE LIKE '%${transportType}%'
      </if>
      <if test="receiveTime != null">
        and TO_CHAR(RECEIVE_TIME,'yyyy-MM-dd') = #{receiveTime}
      </if>
      <if test="createMan != null and createMan != ''">
        and CREATE_MAN LIKE '%${createMan}%'
      </if>
      <if test="createTime != null">
        and TO_CHAR(CREATE_TIME,'yyyy-MM-dd') = #{createTime}
      </if>
      <if test="updateMan != null and updateMan != ''">
        and UPDATE_MAN LIKE '%${updateMan}%'
      </if>
      <if test="updateTime != null">
        and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
      </if>
      <if test="memo != null and memo != ''">
        and MEMO LIKE '%${memo}%'
      </if>
      <if test="purpose != null and purpose != ''">
        and PURPOSE LIKE '%${purpose}%'
      </if>
      <if test="unitid != null and unitid != ''">
        and UNITID LIKE '%${unitid}%'
      </if>
      <if test="dimension != null and dimension != ''">
        and DIMENSION LIKE '%${dimension}%'
      </if>
      <if test="kxfWeight != null">
        and KXF_WEIGHT = #{kxfWeight}
      </if>
      <if test="yxfWeight != null">
        and YXF_WEIGHT = #{yxfWeight}
      </if>
      <if test="planWeight != null">
        and PLAN_WEIGHT = #{planWeight}
      </if>
      <if test="tag != null and tag != ''">
        and TAG LIKE '%${tag}%'
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from EMS_GM_PC_JH
    where ID = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from EMS_GM_PC_JH
    where 1!=1 
      <if test="jhTime != null">
        or TO_CHAR(JH_TIME,'yyyy-MM-dd') = '#{jhTime}'
      </if>
      <if test="state != null and state != ''">
        or STATE = #{state}
      </if>
      <if test="grades != null and grades != ''">
        or GRADES = #{grades}
      </if>
      <if test="specifications != null and specifications != ''">
        or SPECIFICATIONS = #{specifications}
      </if>
      <if test="lengths != null">
        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="workprocType != null and workprocType != ''">
        or WORKPROC_TYPE = #{workprocType}
      </if>
      <if test="iateralArea != null and iateralArea != ''">
        or IATERAL_AREA = #{iateralArea}
      </if>
      <if test="lengthTimesWidth != null and lengthTimesWidth != ''">
        or LENGTH_TIMES_WIDTH = #{lengthTimesWidth}
      </if>
      <if test="transportType != null and transportType != ''">
        or TRANSPORT_TYPE = #{transportType}
      </if>
      <if test="receiveTime != null">
        or TO_CHAR(RECEIVE_TIME,'yyyy-MM-dd') = '#{receiveTime}'
      </if>
      <if test="createMan != null and createMan != ''">
        or CREATE_MAN = #{createMan}
      </if>
      <if test="createTime != null">
        or TO_CHAR(CREATE_TIME,'yyyy-MM-dd') = '#{createTime}'
      </if>
      <if test="updateMan != null and updateMan != ''">
        or UPDATE_MAN = #{updateMan}
      </if>
      <if test="updateTime != null">
        or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
      </if>
      <if test="memo != null and memo != ''">
        or MEMO = #{memo}
      </if>
      <if test="purpose != null and purpose != ''">
        or PURPOSE = #{purpose}
      </if>
      <if test="unitid != null and unitid != ''">
        or UNITID = #{unitid}
      </if>
      <if test="dimension != null and dimension != ''">
        or DIMENSION = #{dimension}
      </if>
      <if test="kxfWeight != null">
        or KXF_WEIGHT = #{kxfWeight}
      </if>
      <if test="yxfWeight != null">
        or YXF_WEIGHT = #{yxfWeight}
      </if>
      <if test="planWeight != null">
        or PLAN_WEIGHT = #{planWeight}
      </if>
    <if test="tag != null and tag != ''">
      or TAG = #{tag}
    </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.ems.emsgmpcjh.model.EmsGmPcJh">
    insert into EMS_GM_PC_JH (ID, JH_TIME, STATE, 
      GRADES, SPECIFICATIONS, LENGTHS, 
      CHEMICAL_STANDARD, SURFACE_STANDARD, WORKPROC_TYPE, 
      IATERAL_AREA, LENGTH_TIMES_WIDTH, TRANSPORT_TYPE, 
      RECEIVE_TIME, CREATE_MAN, CREATE_TIME, 
      UPDATE_MAN, UPDATE_TIME, MEMO, 
      PURPOSE, UNITID, DIMENSION, 
      KXF_WEIGHT, YXF_WEIGHT, PLAN_WEIGHT,DELIVERY_DATE,GM_REVIEWER,GM_REVIEWER_TIME,TAG
      )
    values (#{id,jdbcType=VARCHAR}, #{jhTime,jdbcType=TIMESTAMP}, #{state,jdbcType=VARCHAR}, 
      #{grades,jdbcType=VARCHAR}, #{specifications,jdbcType=VARCHAR}, #{lengths,jdbcType=DECIMAL}, 
      #{chemicalStandard,jdbcType=VARCHAR}, #{surfaceStandard,jdbcType=VARCHAR}, #{workprocType,jdbcType=VARCHAR}, 
      #{iateralArea,jdbcType=VARCHAR}, #{lengthTimesWidth,jdbcType=VARCHAR}, #{transportType,jdbcType=VARCHAR}, 
      #{receiveTime,jdbcType=TIMESTAMP}, #{createMan,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, 
      #{updateMan,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{memo,jdbcType=VARCHAR}, 
      #{purpose,jdbcType=VARCHAR}, #{unitid,jdbcType=VARCHAR}, #{dimension,jdbcType=VARCHAR}, 
      #{kxfWeight,jdbcType=DECIMAL}, #{yxfWeight,jdbcType=DECIMAL}, #{planWeight,jdbcType=DECIMAL},
      #{deliveryDate,jdbcType=TIMESTAMP},#{gmReviewer,jdbcType=VARCHAR},#{gmReviewerTime,jdbcType=TIMESTAMP}, #{tag,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.ems.emsgmpcjh.model.EmsGmPcJh">
    insert into EMS_GM_PC_JH
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        ID,
      </if>
      <if test="jhTime != null">
        JH_TIME,
      </if>
      <if test="state != null">
        STATE,
      </if>
      <if test="grades != null">
        GRADES,
      </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="workprocType != null">
        WORKPROC_TYPE,
      </if>
      <if test="iateralArea != null">
        IATERAL_AREA,
      </if>
      <if test="lengthTimesWidth != null">
        LENGTH_TIMES_WIDTH,
      </if>
      <if test="transportType != null">
        TRANSPORT_TYPE,
      </if>
      <if test="receiveTime != null">
        RECEIVE_TIME,
      </if>
      <if test="createMan != null">
        CREATE_MAN,
      </if>
      <if test="createTime != null">
        CREATE_TIME,
      </if>
      <if test="updateMan != null">
        UPDATE_MAN,
      </if>
      <if test="updateTime != null">
        UPDATE_TIME,
      </if>
      <if test="memo != null">
        MEMO,
      </if>
      <if test="purpose != null">
        PURPOSE,
      </if>
      <if test="unitid != null">
        UNITID,
      </if>
      <if test="dimension != null">
        DIMENSION,
      </if>
      <if test="kxfWeight != null">
        KXF_WEIGHT,
      </if>
      <if test="yxfWeight != null">
        YXF_WEIGHT,
      </if>
      <if test="planWeight != null">
        PLAN_WEIGHT,
      </if>
      <if test="tag != null">
        TAG,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="jhTime != null">
        #{jhTime,jdbcType=TIMESTAMP},
      </if>
      <if test="state != null">
        #{state,jdbcType=VARCHAR},
      </if>
      <if test="grades != null">
        #{grades,jdbcType=VARCHAR},
      </if>
      <if test="specifications != null">
        #{specifications,jdbcType=VARCHAR},
      </if>
      <if test="lengths != null">
        #{lengths,jdbcType=DECIMAL},
      </if>
      <if test="chemicalStandard != null">
        #{chemicalStandard,jdbcType=VARCHAR},
      </if>
      <if test="surfaceStandard != null">
        #{surfaceStandard,jdbcType=VARCHAR},
      </if>
      <if test="workprocType != null">
        #{workprocType,jdbcType=VARCHAR},
      </if>
      <if test="iateralArea != null">
        #{iateralArea,jdbcType=VARCHAR},
      </if>
      <if test="lengthTimesWidth != null">
        #{lengthTimesWidth,jdbcType=VARCHAR},
      </if>
      <if test="transportType != null">
        #{transportType,jdbcType=VARCHAR},
      </if>
      <if test="receiveTime != null">
        #{receiveTime,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="memo != null">
        #{memo,jdbcType=VARCHAR},
      </if>
      <if test="purpose != null">
        #{purpose,jdbcType=VARCHAR},
      </if>
      <if test="unitid != null">
        #{unitid,jdbcType=VARCHAR},
      </if>
      <if test="dimension != null">
        #{dimension,jdbcType=VARCHAR},
      </if>
      <if test="kxfWeight != null">
        #{kxfWeight,jdbcType=DECIMAL},
      </if>
      <if test="yxfWeight != null">
        #{yxfWeight,jdbcType=DECIMAL},
      </if>
      <if test="planWeight != null">
        #{planWeight,jdbcType=DECIMAL},
      </if>
      <if test="tag != null">
        #{tag,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.emsgmpcjh.model.EmsGmPcJh">
    update EMS_GM_PC_JH
    set JH_TIME = #{jhTime,jdbcType=TIMESTAMP},
      STATE = #{state,jdbcType=VARCHAR},
      GRADES = #{grades,jdbcType=VARCHAR},
      SPECIFICATIONS = #{specifications,jdbcType=VARCHAR},
      LENGTHS = #{lengths,jdbcType=DECIMAL},
      CHEMICAL_STANDARD = #{chemicalStandard,jdbcType=VARCHAR},
      SURFACE_STANDARD = #{surfaceStandard,jdbcType=VARCHAR},
      WORKPROC_TYPE = #{workprocType,jdbcType=VARCHAR},
      IATERAL_AREA = #{iateralArea,jdbcType=VARCHAR},
      LENGTH_TIMES_WIDTH = #{lengthTimesWidth,jdbcType=VARCHAR},
      TRANSPORT_TYPE = #{transportType,jdbcType=VARCHAR},
      RECEIVE_TIME = #{receiveTime,jdbcType=TIMESTAMP},
      CREATE_MAN = #{createMan,jdbcType=VARCHAR},
      CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
      UPDATE_MAN = #{updateMan,jdbcType=VARCHAR},
      UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
      MEMO = #{memo,jdbcType=VARCHAR},
      PURPOSE = #{purpose,jdbcType=VARCHAR},
      UNITID = #{unitid,jdbcType=VARCHAR},
      DIMENSION = #{dimension,jdbcType=VARCHAR},
      KXF_WEIGHT = #{kxfWeight,jdbcType=DECIMAL},
      YXF_WEIGHT = #{yxfWeight,jdbcType=DECIMAL},
      PLAN_WEIGHT = #{planWeight,jdbcType=DECIMAL},
      DELIVERY_DATE   = #{deliveryDate,jdbcType=TIMESTAMP},
      GM_REVIEWER = #{gmReviewer,jdbcType=TIMESTAMP},
      GM_REVIEWER_TIME = #{gmReviewerTime,jdbcType=TIMESTAMP},
    TAG = #{tag,jdbcType=VARCHAR}
    where ID = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.emsgmpcjh.model.EmsGmPcJh">
    update EMS_GM_PC_JH
    <set>
      <if test="jhTime != null">
        JH_TIME = #{jhTime,jdbcType=TIMESTAMP},
      </if>
      <if test="state != null">
        STATE = #{state,jdbcType=VARCHAR},
      </if>
      <if test="grades != null">
        GRADES = #{grades,jdbcType=VARCHAR},
      </if>
      <if test="specifications != null">
        SPECIFICATIONS = #{specifications,jdbcType=VARCHAR},
      </if>
      <if test="lengths != null">
        LENGTHS = #{lengths,jdbcType=DECIMAL},
      </if>
      <if test="chemicalStandard != null">
        CHEMICAL_STANDARD = #{chemicalStandard,jdbcType=VARCHAR},
      </if>
      <if test="surfaceStandard != null">
        SURFACE_STANDARD = #{surfaceStandard,jdbcType=VARCHAR},
      </if>
      <if test="workprocType != null">
        WORKPROC_TYPE = #{workprocType,jdbcType=VARCHAR},
      </if>
      <if test="iateralArea != null">
        IATERAL_AREA = #{iateralArea,jdbcType=VARCHAR},
      </if>
      <if test="lengthTimesWidth != null">
        LENGTH_TIMES_WIDTH = #{lengthTimesWidth,jdbcType=VARCHAR},
      </if>
      <if test="transportType != null">
        TRANSPORT_TYPE = #{transportType,jdbcType=VARCHAR},
      </if>
      <if test="receiveTime != null">
        RECEIVE_TIME = #{receiveTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createMan != null">
        CREATE_MAN = #{createMan,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateMan != null">
        UPDATE_MAN = #{updateMan,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null">
        UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="memo != null">
        MEMO = #{memo,jdbcType=VARCHAR},
      </if>
      <if test="purpose != null">
        PURPOSE = #{purpose,jdbcType=VARCHAR},
      </if>
      <if test="unitid != null">
        UNITID = #{unitid,jdbcType=VARCHAR},
      </if>
      <if test="dimension != null">
        DIMENSION = #{dimension,jdbcType=VARCHAR},
      </if>
      <if test="kxfWeight != null">
        KXF_WEIGHT = #{kxfWeight,jdbcType=DECIMAL},
      </if>
      <if test="yxfWeight != null">
        YXF_WEIGHT = #{yxfWeight,jdbcType=DECIMAL},
      </if>
      <if test="planWeight != null">
        PLAN_WEIGHT = #{planWeight,jdbcType=DECIMAL},
      </if>
      <if test="tag != null">
        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_GM_PC_JH 
      (ID, 
      JH_TIME, STATE, GRADES, 
      SPECIFICATIONS, LENGTHS, CHEMICAL_STANDARD, 
      SURFACE_STANDARD, WORKPROC_TYPE, 
      IATERAL_AREA, LENGTH_TIMES_WIDTH, 
      TRANSPORT_TYPE, RECEIVE_TIME, 
      CREATE_MAN, CREATE_TIME, UPDATE_MAN, 
      UPDATE_TIME, MEMO, PURPOSE, 
      UNITID, DIMENSION, KXF_WEIGHT, 
      YXF_WEIGHT, PLAN_WEIGHT,DELIVERY_DATE,TAG)
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.id,jdbcType=VARCHAR}, 
      #{item.jhTime,jdbcType=TIMESTAMP}, #{item.state,jdbcType=VARCHAR}, #{item.grades,jdbcType=VARCHAR}, 
      #{item.specifications,jdbcType=VARCHAR}, #{item.lengths,jdbcType=DECIMAL}, #{item.chemicalStandard,jdbcType=VARCHAR}, 
      #{item.surfaceStandard,jdbcType=VARCHAR}, #{item.workprocType,jdbcType=VARCHAR}, 
      #{item.iateralArea,jdbcType=VARCHAR}, #{item.lengthTimesWidth,jdbcType=VARCHAR}, 
      #{item.transportType,jdbcType=VARCHAR}, #{item.receiveTime,jdbcType=TIMESTAMP}, 
      #{item.createMan,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.updateMan,jdbcType=VARCHAR}, 
      #{item.updateTime,jdbcType=TIMESTAMP}, #{item.memo,jdbcType=VARCHAR}, #{item.purpose,jdbcType=VARCHAR}, 
      #{item.unitid,jdbcType=VARCHAR}, #{item.dimension,jdbcType=VARCHAR}, #{item.kxfWeight,jdbcType=DECIMAL}, 
      #{item.yxfWeight,jdbcType=DECIMAL}, #{item.planWeight,jdbcType=DECIMAL}, #{item.deliveryDate,jdbcType=DECIMAL}, #{item.tag,jdbcType=VARCHAR} from dual
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update EMS_GM_PC_JH
     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>
       ,JH_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.jhTime,jdbcType=TIMESTAMP}
       </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>
       ,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=DECIMAL}
       </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>
       ,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>
       ,IATERAL_AREA=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.iateralArea,jdbcType=VARCHAR}
       </foreach>
       ,LENGTH_TIMES_WIDTH=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.lengthTimesWidth,jdbcType=VARCHAR}
       </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>
       ,RECEIVE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.receiveTime,jdbcType=TIMESTAMP}
       </foreach>
       ,CREATE_MAN=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.createMan,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.createTime,jdbcType=TIMESTAMP}
       </foreach>
       ,UPDATE_MAN=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.updateMan,jdbcType=VARCHAR}
       </foreach>
       ,UPDATE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.updateTime,jdbcType=TIMESTAMP}
       </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>
       ,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>
       ,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>
       ,DIMENSION=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.dimension,jdbcType=VARCHAR}
       </foreach>
       ,KXF_WEIGHT=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.kxfWeight,jdbcType=DECIMAL}
       </foreach>
       ,YXF_WEIGHT=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.yxfWeight,jdbcType=DECIMAL}
       </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>
    ,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_GM_PC_JH
    where ID in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->
  <!-- to_char(nvl(max(substr(ID, 15, 2) + 1), 1), 'fm00') as ID 2022-02-11更改为3位 -->
  <select id="getMaxid" parameterType="com.steerinfo.ems.emsgmpcjh.model.EmsGmPcJh" resultType="java.lang.String">
 select
    <choose>
      <when test='tag != null and tag != "" and tag != "1"'>
        #{type} || #{startTime} || '-' || to_char(nvl(max(substr(ID, 15, 2) + 1), 1), 'fm00') as ID
      </when>
      <otherwise>
        #{type} || #{startTime} || '-' || to_char(nvl(max(substr(ID, 15, 3) + 1), 1), 'fm000') as ID
      </otherwise>
    </choose>
  from ems_gm_pc_jh
 where WORKPROC_TYPE = #{workprocType}
   and ID like '%' || #{type} || '%'
   and JH_TIME = #{jhTime}
   and TAG = #{tag}
  </select>
  <update id="updateState" parameterType="com.steerinfo.ems.emsgmpcjh.model.EmsGmPcJh">
    update ems_gm_pc_jh
    <set>
      <if test="state != null and state != ''">
        STATE = #{state},
      </if>
<!--      <if test="grades != null and grades!= ''">-->
<!--        GRADES = #{grades},-->
<!--      </if>-->
<!--      <if test="specifications != null and specifications != '' ">-->
<!--        SPECIFICATIONS = #{specifications},-->
<!--      </if>-->
<!--      <if test="lengths != null and lengths != '' ">-->
<!--        LENGTHS = #{lengths},-->
<!--      </if>-->
      <if test="gmReviewer != null and gmReviewer != '' ">
        GM_REVIEWER = #{gmReviewer},
      </if>

      <if test="gmReviewerTime != null ">
        GM_REVIEWER_TIME = #{gmReviewerTime}
      </if>
    </set>
    <where>
      <if test="workprocType != null and workprocType!= ''">
        and WORKPROC_TYPE = #{workprocType}
      </if>
      <if test="id != null and id !=''">
        and  ID = #{id}
      </if>
    </where>
  </update>
  <!--轮次计划页面查询-->
  <select id="getGmPcJhData" parameterType="java.util.HashMap" resultType="Map">
<!--    select ID as id , to_char(JH_TIME,'yyyy-mm-dd') as jhTime, STATE as state, GRADES as grades, SPECIFICATIONS as specifications, LENGTHS as lengths, CHEMICAL_STANDARD as chemicalstandard, SURFACE_STANDARD as surfacestandard,-->
<!--    WORKPROC_TYPE as workprocType, IATERAL_AREA as iateralArea,  LENGTH_TIMES_WIDTH as lengthtimeswidth, TRANSPORT_TYPE as transportType , RECEIVE_TIME as receivetime, CREATE_MAN as createman,-->
<!--    CREATE_TIME as createtime, UPDATE_MAN as updateman, UPDATE_TIME as updatime , MEMO as memo , PURPOSE as purpose, UNITID as unitid, DIMENSION as dimension, PLAN_WEIGHT as planweight,KXF_WEIGHT,YXF_WEIGHT,TO_CHAR(DELIVERY_DATE,'yyyy-mm-dd') as deliveryDate-->
<!--      from (select *-->
<!--              from ems_gm_pc_jh t-->
<!--              <where>-->
<!--                <if test="startTime != null and startTime != '' and endTime !=null and endTime!='' ">-->
<!--                  and  JH_TIME between to_date(#{startTime},'yyyy-mm-dd')  and to_date(#{endTime},'yyyy-mm-dd')-->
<!--                </if>-->
<!--              </where>-->
<!--            union-->
<!--            select *-->
<!--              from ems_gm_pc_jh-->
<!--            <where>-->
<!--              <if test="startTime != null and startTime != '' and endTime !=null and endTime!='' ">-->
<!--                and  JH_TIME between to_date(substr(#{startTime}, 0, 7) || '-01','yyyy-mm-dd')  and to_date(substr(#{endTime}, 0, 7) || '-01','yyyy-mm-dd')-->
<!--              </if>-->
<!--               and ID like 'N%'-->
<!--            </where>-->
<!--            order by JH_TIME desc-->
<!--            ) t1-->
<!--            <where>-->
<!--              <if test="workprocType != null and workprocType!= ''">-->
<!--                and WORKPROC_TYPE in (${workprocType})-->
<!--              </if>-->
<!--              <if test="id != null and id != ''">-->
<!--                and id = #{id}-->
<!--              </if>-->
<!--                and state in ('2','3')-->
<!--            </where>-->
    select ID as id , to_char(JH_TIME,'yyyy-mm-dd') as jhTime, STATE as state,TAG, GRADES as grades, SPECIFICATIONS as specifications, LENGTHS as lengths, CHEMICAL_STANDARD as chemicalstandard, SURFACE_STANDARD as surfacestandard,
    WORKPROC_TYPE as workprocType, IATERAL_AREA as iateralArea,  LENGTH_TIMES_WIDTH as lengthtimeswidth, TRANSPORT_TYPE as transportType , RECEIVE_TIME as receivetime, CREATE_MAN as createman,
    CREATE_TIME as createtime, UPDATE_MAN as updateman, UPDATE_TIME as updatime , MEMO as memo , PURPOSE as purpose, UNITID as unitid, DIMENSION as dimension, PLAN_WEIGHT as planweight,KXF_WEIGHT,YXF_WEIGHT,TO_CHAR(DELIVERY_DATE,'yyyy-mm-dd') as deliveryDate
    from ems_gm_pc_jh t
    <where>
      <if test="startTime != null and startTime != '' and endTime !=null and endTime!='' ">
        and  JH_TIME between to_date(#{startTime},'yyyy-mm-dd')  and to_date(#{endTime},'yyyy-mm-dd')
      </if>
      <if test="workprocType != null and workprocType!= ''">
        and WORKPROC_TYPE in (${workprocType})
      </if>
      <if test="grades != null and grades!= ''">
        and GRADES in (${grades})
      </if>
      <if test="specifications != null and specifications != ''">
        and SPECIFICATIONS in (${specifications})
      </if>
      <if test="id != null and id != ''">
        and id = #{id}
      </if>
      <if test="state == null || state == ''">
        and state in ('2','3')
      </if>
      <if test="state != null and state != ''">
        and state = #{state}
      </if>
    </where>
    order by JH_TIME desc,ID desc
  </select>
  <!--国贸计划查询-->
<select id="getXsDdDate" parameterType="java.util.HashMap" resultType="Map">
  select t.id,
         to_char(t.jh_time,'yyyy-mm-dd') jh_time,
         t.WORKPROC_TYPE,
         to_char(t.DELIVERY_DATE,'yyyy-mm-dd') DELIVERY_DATE,
         t.state,
         t.grades,
         t.specifications,
         t.lengths,
         t2.plan_weight,
         t2.plan_weight_old,
         t2.submitter,
         t2.submit_time,
         t2.reviewer,
         t2.reviewer_time,
         t2.AUDIT_STATUS,
         t2.GM_REVIEWER,
         t2.GM_REVIEWER_TIME,
         t2.PLAN_WEIGHT - t2.PLAN_WEIGHT_OLD TZL
    from ems_gm_pc_jh t
    left join ems_prodplan_weight_adjustment t2
      on t.id = t2.id
      <where>
        <if test="id != null and id != '' ">
          and t.id = #{id}
        </if>
        <if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
          and t.jh_time between to_date(#{startTime}, 'yyyy-mm-dd') and to_date(#{endTime}, 'yyyy-mm-dd')
        </if>
        <if test="auditStatus != null and auditStatus != '' ">
          and t2.AUDIT_STATUS in (${auditStatus})
        </if>
        <if test="workprocType != null and workprocType!= '' ">
          and WORKPROC_TYPE in (${workprocType})
        </if>
        and t.id like '%G-%'
        and t.state = '3'
      </where>
      order by t.jh_time desc,t.id asc
</select>
  <!--审核页面查询-->
  <select id="getShData" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    select t.id,
       t.jh_time,
       t.state,
       t.workproc_type,
       t.Delivery_Date,
       t.grades,
       t.specifications,
       t.lengths,
       t.length_times_width,
       t.plan_weight,
       t.transport_type,
       t.purpose,
       t.create_man,
       t.create_time,
       t.GM_REVIEWER,
       t.GM_REVIEWER_TIME,
    t.TAG
      from ems_gm_pc_jh t
      <where>
        <if test="startTime != null and startTime != ''  and endTime != null  and endTime != '' ">
         and t.jh_time between to_date(#{startTime},'yyyy-mm-dd') and to_date(#{endTime},'yyyy-mm-dd')
        </if>
        <if test="workprocType != null and workprocType != ''">
          and t.workproc_type in (${workprocType})
        </if>
        <if test="id != null and id != '' ">
          and t.id = #{id}
        </if>
        <if test="state != null and state != ''">
          and t.state in (${state})
        </if>
        and t.id like '%G-%'
      </where>
      order by t.jh_time desc,t.id asc
  </select>
<!--  查询唯一数据-->
  <select id="getOlnyData" parameterType="com.steerinfo.ems.emsgmpcjh.model.EmsGmPcJh" resultMap="BaseResultMap">
    select * from ems_gm_pc_jh
    WHERE WORKPROC_TYPE = #{workprocType}
    and ID like '%' || #{type} || '%'
    and JH_TIME = #{jhTime}
    and DELIVERY_DATE = #{deliveryDate}
    and GRADES = #{grades}
    AND SPECIFICATIONS = #{specifications}
    AND TAG = '1'
  </select>
</mapper>