<?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.huaheng.pc.shipment.shipmentHeader.mapper.ShipmentHeaderMapperAuto">
  <select id="selectListEntityByLike" resultType="com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader">
   SELECT id, code, warehouseId, warehouseCode, companyId, companyCode, sourceCode, sourcePlatform, type, shipTo, priority, station, totalQty, totalLines, remark, uploadremark, uploadTime, appointmentTime, firstStatus, lastStatus, uploadStatus, created, createdBy, lastUpdated, lastUpdatedBy, enable, deleted, userDef1, userDef2, userDef3  
   FROM shipment_header
  <where>
    <if test="id != null "> 
        AND id = #{id}
    </if>
    <if test="code != null and code != ''"> 
        <bind name="codePattern" value="'%' + code + '%'" />
        AND code like #{codePattern}
    </if>
    <if test="warehouseId != null "> 
        AND warehouseId = #{warehouseId}
    </if>
    <if test="warehouseCode != null and warehouseCode != ''"> 
        <bind name="warehouseCodePattern" value="'%' + warehouseCode + '%'" />
        AND warehouseCode like #{warehouseCodePattern}
    </if>
    <if test="companyId != null "> 
        AND companyId = #{companyId}
    </if>
    <if test="companyCode != null and companyCode != ''"> 
        <bind name="companyCodePattern" value="'%' + companyCode + '%'" />
        AND companyCode like #{companyCodePattern}
    </if>
    <if test="sourceCode != null and sourceCode != ''"> 
        <bind name="sourceCodePattern" value="'%' + sourceCode + '%'" />
        AND sourceCode like #{sourceCodePattern}
    </if>
    <if test="sourcePlatform != null and sourcePlatform != ''"> 
        <bind name="sourcePlatformPattern" value="'%' + sourcePlatform + '%'" />
        AND sourcePlatform like #{sourcePlatformPattern}
    </if>
    <if test="type != null and type != ''"> 
        <bind name="typePattern" value="'%' + type + '%'" />
        AND type like #{typePattern}
    </if>
    <if test="shipTo != null and shipTo != ''"> 
        <bind name="shipToPattern" value="'%' + shipTo + '%'" />
        AND shipTo like #{shipToPattern}
    </if>
    <if test="priority != null "> 
        AND priority = #{priority}
    </if>
    <if test="station != null and station != ''"> 
        <bind name="stationPattern" value="'%' + station + '%'" />
        AND station like #{stationPattern}
    </if>
    <if test="totalQty != null "> 
        AND totalQty = #{totalQty}
    </if>
    <if test="totalLines != null "> 
        AND totalLines = #{totalLines}
    </if>
    <if test="remark != null and remark != ''"> 
        <bind name="remarkPattern" value="'%' + remark + '%'" />
        AND remark like #{remarkPattern}
    </if>
    <if test="uploadremark != null and uploadremark != ''"> 
        <bind name="uploadremarkPattern" value="'%' + uploadremark + '%'" />
        AND uploadremark like #{uploadremarkPattern}
    </if>
    <if test="params != null and params.uploadTimeBegin != null and params.uploadTimeBegin != ''"> 
        AND uploadTime &gt;= #{params.uploadTimeBegin}
    </if>
    <if test="params != null and params.uploadTimeEnd != null and params.uploadTimeEnd != ''"> 
        AND uploadTime &lt;= #{params.uploadTimeEnd}
    </if>
    <if test="params != null and params.appointmentTimeBegin != null and params.appointmentTimeBegin != ''"> 
        AND appointmentTime &gt;= #{params.appointmentTimeBegin}
    </if>
    <if test="params != null and params.appointmentTimeEnd != null and params.appointmentTimeEnd != ''"> 
        AND appointmentTime &lt;= #{params.appointmentTimeEnd}
    </if>
    <if test="firstStatus != null "> 
        AND firstStatus = #{firstStatus}
    </if>
    <if test="lastStatus != null "> 
        AND lastStatus = #{lastStatus}
    </if>
    <if test="uploadStatus != null "> 
        AND uploadStatus = #{uploadStatus}
    </if>
    <if test="params != null and params.createdBegin != null and params.createdBegin != ''"> 
        AND created &gt;= #{params.createdBegin}
    </if>
    <if test="params != null and params.createdEnd != null and params.createdEnd != ''"> 
        AND created &lt;= #{params.createdEnd}
    </if>
    <if test="createdBy != null and createdBy != ''"> 
        <bind name="createdByPattern" value="'%' + createdBy + '%'" />
        AND createdBy like #{createdByPattern}
    </if>
    <if test="params != null and params.lastUpdatedBegin != null and params.lastUpdatedBegin != ''"> 
        AND lastUpdated &gt;= #{params.lastUpdatedBegin}
    </if>
    <if test="params != null and params.lastUpdatedEnd != null and params.lastUpdatedEnd != ''"> 
        AND lastUpdated &lt;= #{params.lastUpdatedEnd}
    </if>
    <if test="lastUpdatedBy != null and lastUpdatedBy != ''"> 
        <bind name="lastUpdatedByPattern" value="'%' + lastUpdatedBy + '%'" />
        AND lastUpdatedBy like #{lastUpdatedByPattern}
    </if>
    <if test="enable != null "> 
        AND enable = #{enable}
    </if>
    <if test="deleted != null "> 
        AND deleted = #{deleted}
    </if>
    <if test="userDef1 != null and userDef1 != ''"> 
        <bind name="userDef1Pattern" value="'%' + userDef1 + '%'" />
        AND userDef1 like #{userDef1Pattern}
    </if>
    <if test="userDef2 != null and userDef2 != ''"> 
        <bind name="userDef2Pattern" value="'%' + userDef2 + '%'" />
        AND userDef2 like #{userDef2Pattern}
    </if>
    <if test="userDef3 != null and userDef3 != ''"> 
        <bind name="userDef3Pattern" value="'%' + userDef3 + '%'" />
        AND userDef3 like #{userDef3Pattern}
    </if>
  </where>
  </select>

  <select id="selectListEntityByEqual" resultType="com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader">
   SELECT id, code, warehouseId, warehouseCode, companyId, companyCode, sourceCode, sourcePlatform, type, shipTo, priority, station, totalQty, totalLines, remark, uploadremark, uploadTime, appointmentTime, firstStatus, lastStatus, uploadStatus, created, createdBy, lastUpdated, lastUpdatedBy, enable, deleted, userDef1, userDef2, userDef3  
   FROM shipment_header
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="code != null"> 
        AND code = #{code}
    </if>
    <if test="warehouseId != null"> 
        AND warehouseId = #{warehouseId}
    </if>
    <if test="warehouseCode != null"> 
        AND warehouseCode = #{warehouseCode}
    </if>
    <if test="companyId != null"> 
        AND companyId = #{companyId}
    </if>
    <if test="companyCode != null"> 
        AND companyCode = #{companyCode}
    </if>
    <if test="sourceCode != null"> 
        AND sourceCode = #{sourceCode}
    </if>
    <if test="sourcePlatform != null"> 
        AND sourcePlatform = #{sourcePlatform}
    </if>
    <if test="type != null"> 
        AND type = #{type}
    </if>
    <if test="shipTo != null"> 
        AND shipTo = #{shipTo}
    </if>
    <if test="priority != null"> 
        AND priority = #{priority}
    </if>
    <if test="station != null"> 
        AND station = #{station}
    </if>
    <if test="totalQty != null"> 
        AND totalQty = #{totalQty}
    </if>
    <if test="totalLines != null"> 
        AND totalLines = #{totalLines}
    </if>
    <if test="remark != null"> 
        AND remark = #{remark}
    </if>
    <if test="uploadremark != null"> 
        AND uploadremark = #{uploadremark}
    </if>
    <if test="uploadTime != null"> 
        AND uploadTime = #{uploadTime}
    </if>
    <if test="appointmentTime != null"> 
        AND appointmentTime = #{appointmentTime}
    </if>
    <if test="firstStatus != null"> 
        AND firstStatus = #{firstStatus}
    </if>
    <if test="lastStatus != null"> 
        AND lastStatus = #{lastStatus}
    </if>
    <if test="uploadStatus != null"> 
        AND uploadStatus = #{uploadStatus}
    </if>
    <if test="created != null"> 
        AND created = #{created}
    </if>
    <if test="createdBy != null"> 
        AND createdBy = #{createdBy}
    </if>
    <if test="lastUpdated != null"> 
        AND lastUpdated = #{lastUpdated}
    </if>
    <if test="lastUpdatedBy != null"> 
        AND lastUpdatedBy = #{lastUpdatedBy}
    </if>
    <if test="enable != null"> 
        AND enable = #{enable}
    </if>
    <if test="deleted != null"> 
        AND deleted = #{deleted}
    </if>
    <if test="userDef1 != null"> 
        AND userDef1 = #{userDef1}
    </if>
    <if test="userDef2 != null"> 
        AND userDef2 = #{userDef2}
    </if>
    <if test="userDef3 != null"> 
        AND userDef3 = #{userDef3}
    </if>
  </where>
  </select>

  <select id="selectListMapByEqual" resultType="java.util.HashMap">
      SELECT ${columns} FROM shipment_header
  <where>
    <if test="condition.id != null"> 
        AND id = #{condition.id}
    </if>
    <if test="condition.code != null"> 
        AND code = #{condition.code}
    </if>
    <if test="condition.warehouseId != null"> 
        AND warehouseId = #{condition.warehouseId}
    </if>
    <if test="condition.warehouseCode != null"> 
        AND warehouseCode = #{condition.warehouseCode}
    </if>
    <if test="condition.companyId != null"> 
        AND companyId = #{condition.companyId}
    </if>
    <if test="condition.companyCode != null"> 
        AND companyCode = #{condition.companyCode}
    </if>
    <if test="condition.sourceCode != null"> 
        AND sourceCode = #{condition.sourceCode}
    </if>
    <if test="condition.sourcePlatform != null"> 
        AND sourcePlatform = #{condition.sourcePlatform}
    </if>
    <if test="condition.type != null"> 
        AND type = #{condition.type}
    </if>
    <if test="condition.shipTo != null"> 
        AND shipTo = #{condition.shipTo}
    </if>
    <if test="condition.priority != null"> 
        AND priority = #{condition.priority}
    </if>
    <if test="condition.station != null"> 
        AND station = #{condition.station}
    </if>
    <if test="condition.totalQty != null"> 
        AND totalQty = #{condition.totalQty}
    </if>
    <if test="condition.totalLines != null"> 
        AND totalLines = #{condition.totalLines}
    </if>
    <if test="condition.remark != null"> 
        AND remark = #{condition.remark}
    </if>
    <if test="condition.uploadremark != null"> 
        AND uploadremark = #{condition.uploadremark}
    </if>
    <if test="condition.uploadTime != null"> 
        AND uploadTime = #{condition.uploadTime}
    </if>
    <if test="condition.appointmentTime != null"> 
        AND appointmentTime = #{condition.appointmentTime}
    </if>
    <if test="condition.firstStatus != null"> 
        AND firstStatus = #{condition.firstStatus}
    </if>
    <if test="condition.lastStatus != null"> 
        AND lastStatus = #{condition.lastStatus}
    </if>
    <if test="condition.uploadStatus != null"> 
        AND uploadStatus = #{condition.uploadStatus}
    </if>
    <if test="condition.created != null"> 
        AND created = #{condition.created}
    </if>
    <if test="condition.createdBy != null"> 
        AND createdBy = #{condition.createdBy}
    </if>
    <if test="condition.lastUpdated != null"> 
        AND lastUpdated = #{condition.lastUpdated}
    </if>
    <if test="condition.lastUpdatedBy != null"> 
        AND lastUpdatedBy = #{condition.lastUpdatedBy}
    </if>
    <if test="condition.enable != null"> 
        AND enable = #{condition.enable}
    </if>
    <if test="condition.deleted != null"> 
        AND deleted = #{condition.deleted}
    </if>
    <if test="condition.userDef1 != null"> 
        AND userDef1 = #{condition.userDef1}
    </if>
    <if test="condition.userDef2 != null"> 
        AND userDef2 = #{condition.userDef2}
    </if>
    <if test="condition.userDef3 != null"> 
        AND userDef3 = #{condition.userDef3}
    </if>
  </where>
  </select>

  <select id="selectEntityById" resultType="com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader">
      SELECT id, code, warehouseId, warehouseCode, companyId, companyCode, sourceCode, sourcePlatform, type, shipTo, priority, station, totalQty, totalLines, remark, uploadremark, uploadTime, appointmentTime, firstStatus, lastStatus, uploadStatus, created, createdBy, lastUpdated, lastUpdatedBy, enable, deleted, userDef1, userDef2, userDef3  FROM shipment_header WHERE id = #{id}
  </select>

  <select id="selectFirstEntity" resultType="com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader">
  SELECT id, code, warehouseId, warehouseCode, companyId, companyCode, sourceCode, sourcePlatform, type, shipTo, priority, station, totalQty, totalLines, remark, uploadremark, uploadTime, appointmentTime, firstStatus, lastStatus, uploadStatus, created, createdBy, lastUpdated, lastUpdatedBy, enable, deleted, userDef1, userDef2, userDef3  
  FROM shipment_header
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="code != null"> 
        AND code = #{code}
    </if>
    <if test="warehouseId != null"> 
        AND warehouseId = #{warehouseId}
    </if>
    <if test="warehouseCode != null"> 
        AND warehouseCode = #{warehouseCode}
    </if>
    <if test="companyId != null"> 
        AND companyId = #{companyId}
    </if>
    <if test="companyCode != null"> 
        AND companyCode = #{companyCode}
    </if>
    <if test="sourceCode != null"> 
        AND sourceCode = #{sourceCode}
    </if>
    <if test="sourcePlatform != null"> 
        AND sourcePlatform = #{sourcePlatform}
    </if>
    <if test="type != null"> 
        AND type = #{type}
    </if>
    <if test="shipTo != null"> 
        AND shipTo = #{shipTo}
    </if>
    <if test="priority != null"> 
        AND priority = #{priority}
    </if>
    <if test="station != null"> 
        AND station = #{station}
    </if>
    <if test="totalQty != null"> 
        AND totalQty = #{totalQty}
    </if>
    <if test="totalLines != null"> 
        AND totalLines = #{totalLines}
    </if>
    <if test="remark != null"> 
        AND remark = #{remark}
    </if>
    <if test="uploadremark != null"> 
        AND uploadremark = #{uploadremark}
    </if>
    <if test="uploadTime != null"> 
        AND uploadTime = #{uploadTime}
    </if>
    <if test="appointmentTime != null"> 
        AND appointmentTime = #{appointmentTime}
    </if>
    <if test="firstStatus != null"> 
        AND firstStatus = #{firstStatus}
    </if>
    <if test="lastStatus != null"> 
        AND lastStatus = #{lastStatus}
    </if>
    <if test="uploadStatus != null"> 
        AND uploadStatus = #{uploadStatus}
    </if>
    <if test="created != null"> 
        AND created = #{created}
    </if>
    <if test="createdBy != null"> 
        AND createdBy = #{createdBy}
    </if>
    <if test="lastUpdated != null"> 
        AND lastUpdated = #{lastUpdated}
    </if>
    <if test="lastUpdatedBy != null"> 
        AND lastUpdatedBy = #{lastUpdatedBy}
    </if>
    <if test="enable != null"> 
        AND enable = #{enable}
    </if>
    <if test="deleted != null"> 
        AND deleted = #{deleted}
    </if>
    <if test="userDef1 != null"> 
        AND userDef1 = #{userDef1}
    </if>
    <if test="userDef2 != null"> 
        AND userDef2 = #{userDef2}
    </if>
    <if test="userDef3 != null"> 
        AND userDef3 = #{userDef3}
    </if>
  </where>
   LIMIT 1 
  </select>

  <select id="selectFirstMap" resultType="java.util.HashMap">
      SELECT ${columns} FROM shipment_header
  <where>
    <if test="condition.id != null"> 
        AND id = #{condition.id}
    </if>
    <if test="condition.code != null"> 
        AND code = #{condition.code}
    </if>
    <if test="condition.warehouseId != null"> 
        AND warehouseId = #{condition.warehouseId}
    </if>
    <if test="condition.warehouseCode != null"> 
        AND warehouseCode = #{condition.warehouseCode}
    </if>
    <if test="condition.companyId != null"> 
        AND companyId = #{condition.companyId}
    </if>
    <if test="condition.companyCode != null"> 
        AND companyCode = #{condition.companyCode}
    </if>
    <if test="condition.sourceCode != null"> 
        AND sourceCode = #{condition.sourceCode}
    </if>
    <if test="condition.sourcePlatform != null"> 
        AND sourcePlatform = #{condition.sourcePlatform}
    </if>
    <if test="condition.type != null"> 
        AND type = #{condition.type}
    </if>
    <if test="condition.shipTo != null"> 
        AND shipTo = #{condition.shipTo}
    </if>
    <if test="condition.priority != null"> 
        AND priority = #{condition.priority}
    </if>
    <if test="condition.station != null"> 
        AND station = #{condition.station}
    </if>
    <if test="condition.totalQty != null"> 
        AND totalQty = #{condition.totalQty}
    </if>
    <if test="condition.totalLines != null"> 
        AND totalLines = #{condition.totalLines}
    </if>
    <if test="condition.remark != null"> 
        AND remark = #{condition.remark}
    </if>
    <if test="condition.uploadremark != null"> 
        AND uploadremark = #{condition.uploadremark}
    </if>
    <if test="condition.uploadTime != null"> 
        AND uploadTime = #{condition.uploadTime}
    </if>
    <if test="condition.appointmentTime != null"> 
        AND appointmentTime = #{condition.appointmentTime}
    </if>
    <if test="condition.firstStatus != null"> 
        AND firstStatus = #{condition.firstStatus}
    </if>
    <if test="condition.lastStatus != null"> 
        AND lastStatus = #{condition.lastStatus}
    </if>
    <if test="condition.uploadStatus != null"> 
        AND uploadStatus = #{condition.uploadStatus}
    </if>
    <if test="condition.created != null"> 
        AND created = #{condition.created}
    </if>
    <if test="condition.createdBy != null"> 
        AND createdBy = #{condition.createdBy}
    </if>
    <if test="condition.lastUpdated != null"> 
        AND lastUpdated = #{condition.lastUpdated}
    </if>
    <if test="condition.lastUpdatedBy != null"> 
        AND lastUpdatedBy = #{condition.lastUpdatedBy}
    </if>
    <if test="condition.enable != null"> 
        AND enable = #{condition.enable}
    </if>
    <if test="condition.deleted != null"> 
        AND deleted = #{condition.deleted}
    </if>
    <if test="condition.userDef1 != null"> 
        AND userDef1 = #{condition.userDef1}
    </if>
    <if test="condition.userDef2 != null"> 
        AND userDef2 = #{condition.userDef2}
    </if>
    <if test="condition.userDef3 != null"> 
        AND userDef3 = #{condition.userDef3}
    </if>
  </where>
   LIMIT 1 
  </select>

  <insert id="insert" parameterType="com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader" keyProperty="id" useGeneratedKeys="true" >
  INSERT INTO shipment_header 
  <trim prefix="(" suffix=")" suffixOverrides=",">
    <if test="code != null"> 
        code, 
    </if>
    <if test="warehouseId != null"> 
        warehouseId, 
    </if>
    <if test="warehouseCode != null"> 
        warehouseCode, 
    </if>
    <if test="companyId != null"> 
        companyId, 
    </if>
    <if test="companyCode != null"> 
        companyCode, 
    </if>
    <if test="sourceCode != null"> 
        sourceCode, 
    </if>
    <if test="sourcePlatform != null"> 
        sourcePlatform, 
    </if>
    <if test="type != null"> 
        type, 
    </if>
    <if test="shipTo != null"> 
        shipTo, 
    </if>
    <if test="priority != null"> 
        priority, 
    </if>
    <if test="station != null"> 
        station, 
    </if>
    <if test="totalQty != null"> 
        totalQty, 
    </if>
    <if test="totalLines != null"> 
        totalLines, 
    </if>
    <if test="remark != null"> 
        remark, 
    </if>
    <if test="uploadremark != null"> 
        uploadremark, 
    </if>
    <if test="uploadTime != null"> 
        uploadTime, 
    </if>
    <if test="appointmentTime != null"> 
        appointmentTime, 
    </if>
    <if test="firstStatus != null"> 
        firstStatus, 
    </if>
    <if test="lastStatus != null"> 
        lastStatus, 
    </if>
    <if test="uploadStatus != null"> 
        uploadStatus, 
    </if>
    <if test="created != null"> 
        created, 
    </if>
    <if test="createdBy != null"> 
        createdBy, 
    </if>
    <if test="lastUpdated != null"> 
        lastUpdated, 
    </if>
    <if test="lastUpdatedBy != null"> 
        lastUpdatedBy, 
    </if>
    <if test="enable != null"> 
        enable, 
    </if>
    <if test="deleted != null"> 
        deleted, 
    </if>
    <if test="userDef1 != null"> 
        userDef1, 
    </if>
    <if test="userDef2 != null"> 
        userDef2, 
    </if>
    <if test="userDef3 != null"> 
        userDef3, 
    </if>
  </trim>
  <trim prefix=" values (" suffix=")" suffixOverrides=",">
    <if test="code != null"> 
        #{code, jdbcType=VARCHAR}, 
    </if>
    <if test="warehouseId != null"> 
        #{warehouseId, jdbcType=INTEGER}, 
    </if>
    <if test="warehouseCode != null"> 
        #{warehouseCode, jdbcType=VARCHAR}, 
    </if>
    <if test="companyId != null"> 
        #{companyId, jdbcType=INTEGER}, 
    </if>
    <if test="companyCode != null"> 
        #{companyCode, jdbcType=VARCHAR}, 
    </if>
    <if test="sourceCode != null"> 
        #{sourceCode, jdbcType=VARCHAR}, 
    </if>
    <if test="sourcePlatform != null"> 
        #{sourcePlatform, jdbcType=VARCHAR}, 
    </if>
    <if test="type != null"> 
        #{type, jdbcType=VARCHAR}, 
    </if>
    <if test="shipTo != null"> 
        #{shipTo, jdbcType=VARCHAR}, 
    </if>
    <if test="priority != null"> 
        #{priority, jdbcType=SMALLINT}, 
    </if>
    <if test="station != null"> 
        #{station, jdbcType=VARCHAR}, 
    </if>
    <if test="totalQty != null"> 
        #{totalQty, jdbcType=DECIMAL}, 
    </if>
    <if test="totalLines != null"> 
        #{totalLines, jdbcType=SMALLINT}, 
    </if>
    <if test="remark != null"> 
        #{remark, jdbcType=VARCHAR}, 
    </if>
    <if test="uploadremark != null"> 
        #{uploadremark, jdbcType=VARCHAR}, 
    </if>
    <if test="uploadTime != null"> 
        #{uploadTime, jdbcType=TIMESTAMP}, 
    </if>
    <if test="appointmentTime != null"> 
        #{appointmentTime, jdbcType=TIMESTAMP}, 
    </if>
    <if test="firstStatus != null"> 
        #{firstStatus, jdbcType=SMALLINT}, 
    </if>
    <if test="lastStatus != null"> 
        #{lastStatus, jdbcType=SMALLINT}, 
    </if>
    <if test="uploadStatus != null"> 
        #{uploadStatus, jdbcType=SMALLINT}, 
    </if>
    <if test="created != null"> 
        #{created, jdbcType=TIMESTAMP}, 
    </if>
    <if test="createdBy != null"> 
        #{createdBy, jdbcType=VARCHAR}, 
    </if>
    <if test="lastUpdated != null"> 
        #{lastUpdated, jdbcType=TIMESTAMP}, 
    </if>
    <if test="lastUpdatedBy != null"> 
        #{lastUpdatedBy, jdbcType=VARCHAR}, 
    </if>
    <if test="enable != null"> 
        #{enable, jdbcType=BIT}, 
    </if>
    <if test="deleted != null"> 
        #{deleted, jdbcType=BIT}, 
    </if>
    <if test="userDef1 != null"> 
        #{userDef1, jdbcType=VARCHAR}, 
    </if>
    <if test="userDef2 != null"> 
        #{userDef2, jdbcType=VARCHAR}, 
    </if>
    <if test="userDef3 != null"> 
        #{userDef3, jdbcType=VARCHAR}, 
    </if>
  </trim>
  </insert>

  <update id="updateByModel">
  UPDATE shipment_header 
  <set>
    <if test="code != null"> 
        code = #{code, jdbcType=VARCHAR}, 
    </if>
    <if test="warehouseId != null"> 
        warehouseId = #{warehouseId, jdbcType=INTEGER}, 
    </if>
    <if test="warehouseCode != null"> 
        warehouseCode = #{warehouseCode, jdbcType=VARCHAR}, 
    </if>
    <if test="companyId != null"> 
        companyId = #{companyId, jdbcType=INTEGER}, 
    </if>
    <if test="companyCode != null"> 
        companyCode = #{companyCode, jdbcType=VARCHAR}, 
    </if>
    <if test="sourceCode != null"> 
        sourceCode = #{sourceCode, jdbcType=VARCHAR}, 
    </if>
    <if test="sourcePlatform != null"> 
        sourcePlatform = #{sourcePlatform, jdbcType=VARCHAR}, 
    </if>
    <if test="type != null"> 
        type = #{type, jdbcType=VARCHAR}, 
    </if>
    <if test="shipTo != null"> 
        shipTo = #{shipTo, jdbcType=VARCHAR}, 
    </if>
    <if test="priority != null"> 
        priority = #{priority, jdbcType=SMALLINT}, 
    </if>
    <if test="station != null"> 
        station = #{station, jdbcType=VARCHAR}, 
    </if>
    <if test="totalQty != null"> 
        totalQty = #{totalQty, jdbcType=DECIMAL}, 
    </if>
    <if test="totalLines != null"> 
        totalLines = #{totalLines, jdbcType=SMALLINT}, 
    </if>
    <if test="remark != null"> 
        remark = #{remark, jdbcType=VARCHAR}, 
    </if>
    <if test="uploadremark != null"> 
        uploadremark = #{uploadremark, jdbcType=VARCHAR}, 
    </if>
    <if test="uploadTime != null"> 
        uploadTime = #{uploadTime, jdbcType=TIMESTAMP}, 
    </if>
    <if test="appointmentTime != null"> 
        appointmentTime = #{appointmentTime, jdbcType=TIMESTAMP}, 
    </if>
    <if test="firstStatus != null"> 
        firstStatus = #{firstStatus, jdbcType=SMALLINT}, 
    </if>
    <if test="lastStatus != null"> 
        lastStatus = #{lastStatus, jdbcType=SMALLINT}, 
    </if>
    <if test="uploadStatus != null"> 
        uploadStatus = #{uploadStatus, jdbcType=SMALLINT}, 
    </if>
    <if test="created != null"> 
        created = #{created, jdbcType=TIMESTAMP}, 
    </if>
    <if test="createdBy != null"> 
        createdBy = #{createdBy, jdbcType=VARCHAR}, 
    </if>
    <if test="lastUpdated != null"> 
        lastUpdated = #{lastUpdated, jdbcType=TIMESTAMP}, 
    </if>
    <if test="lastUpdatedBy != null"> 
        lastUpdatedBy = #{lastUpdatedBy, jdbcType=VARCHAR}, 
    </if>
    <if test="enable != null"> 
        enable = #{enable, jdbcType=BIT}, 
    </if>
    <if test="deleted != null"> 
        deleted = #{deleted, jdbcType=BIT}, 
    </if>
    <if test="userDef1 != null"> 
        userDef1 = #{userDef1, jdbcType=VARCHAR}, 
    </if>
    <if test="userDef2 != null"> 
        userDef2 = #{userDef2, jdbcType=VARCHAR}, 
    </if>
    <if test="userDef3 != null"> 
        userDef3 = #{userDef3, jdbcType=VARCHAR}, 
    </if>
  </set>
   WHERE id = #{id,jdbcType=INTEGER}
  </update>

  <update id="updateByCondition">
  UPDATE shipment_header 
  <set>
    <if test="record.code != null"> 
        code = #{record.code, jdbcType=VARCHAR}, 
    </if>
    <if test="record.warehouseId != null"> 
        warehouseId = #{record.warehouseId, jdbcType=INTEGER}, 
    </if>
    <if test="record.warehouseCode != null"> 
        warehouseCode = #{record.warehouseCode, jdbcType=VARCHAR}, 
    </if>
    <if test="record.companyId != null"> 
        companyId = #{record.companyId, jdbcType=INTEGER}, 
    </if>
    <if test="record.companyCode != null"> 
        companyCode = #{record.companyCode, jdbcType=VARCHAR}, 
    </if>
    <if test="record.sourceCode != null"> 
        sourceCode = #{record.sourceCode, jdbcType=VARCHAR}, 
    </if>
    <if test="record.sourcePlatform != null"> 
        sourcePlatform = #{record.sourcePlatform, jdbcType=VARCHAR}, 
    </if>
    <if test="record.type != null"> 
        type = #{record.type, jdbcType=VARCHAR}, 
    </if>
    <if test="record.shipTo != null"> 
        shipTo = #{record.shipTo, jdbcType=VARCHAR}, 
    </if>
    <if test="record.priority != null"> 
        priority = #{record.priority, jdbcType=SMALLINT}, 
    </if>
    <if test="record.station != null"> 
        station = #{record.station, jdbcType=VARCHAR}, 
    </if>
    <if test="record.totalQty != null"> 
        totalQty = #{record.totalQty, jdbcType=DECIMAL}, 
    </if>
    <if test="record.totalLines != null"> 
        totalLines = #{record.totalLines, jdbcType=SMALLINT}, 
    </if>
    <if test="record.remark != null"> 
        remark = #{record.remark, jdbcType=VARCHAR}, 
    </if>
    <if test="record.uploadremark != null"> 
        uploadremark = #{record.uploadremark, jdbcType=VARCHAR}, 
    </if>
    <if test="record.uploadTime != null"> 
        uploadTime = #{record.uploadTime, jdbcType=TIMESTAMP}, 
    </if>
    <if test="record.appointmentTime != null"> 
        appointmentTime = #{record.appointmentTime, jdbcType=TIMESTAMP}, 
    </if>
    <if test="record.firstStatus != null"> 
        firstStatus = #{record.firstStatus, jdbcType=SMALLINT}, 
    </if>
    <if test="record.lastStatus != null"> 
        lastStatus = #{record.lastStatus, jdbcType=SMALLINT}, 
    </if>
    <if test="record.uploadStatus != null"> 
        uploadStatus = #{record.uploadStatus, jdbcType=SMALLINT}, 
    </if>
    <if test="record.created != null"> 
        created = #{record.created, jdbcType=TIMESTAMP}, 
    </if>
    <if test="record.createdBy != null"> 
        createdBy = #{record.createdBy, jdbcType=VARCHAR}, 
    </if>
    <if test="record.lastUpdated != null"> 
        lastUpdated = #{record.lastUpdated, jdbcType=TIMESTAMP}, 
    </if>
    <if test="record.lastUpdatedBy != null"> 
        lastUpdatedBy = #{record.lastUpdatedBy, jdbcType=VARCHAR}, 
    </if>
    <if test="record.enable != null"> 
        enable = #{record.enable, jdbcType=BIT}, 
    </if>
    <if test="record.deleted != null"> 
        deleted = #{record.deleted, jdbcType=BIT}, 
    </if>
    <if test="record.userDef1 != null"> 
        userDef1 = #{record.userDef1, jdbcType=VARCHAR}, 
    </if>
    <if test="record.userDef2 != null"> 
        userDef2 = #{record.userDef2, jdbcType=VARCHAR}, 
    </if>
    <if test="record.userDef3 != null"> 
        userDef3 = #{record.userDef3, jdbcType=VARCHAR}, 
    </if>
  </set>
  <where>
    <if test="condition.id != null"> 
        AND id = #{condition.id}
    </if>
    <if test="condition.code != null"> 
        AND code = #{condition.code}
    </if>
    <if test="condition.warehouseId != null"> 
        AND warehouseId = #{condition.warehouseId}
    </if>
    <if test="condition.warehouseCode != null"> 
        AND warehouseCode = #{condition.warehouseCode}
    </if>
    <if test="condition.companyId != null"> 
        AND companyId = #{condition.companyId}
    </if>
    <if test="condition.companyCode != null"> 
        AND companyCode = #{condition.companyCode}
    </if>
    <if test="condition.sourceCode != null"> 
        AND sourceCode = #{condition.sourceCode}
    </if>
    <if test="condition.sourcePlatform != null"> 
        AND sourcePlatform = #{condition.sourcePlatform}
    </if>
    <if test="condition.type != null"> 
        AND type = #{condition.type}
    </if>
    <if test="condition.shipTo != null"> 
        AND shipTo = #{condition.shipTo}
    </if>
    <if test="condition.priority != null"> 
        AND priority = #{condition.priority}
    </if>
    <if test="condition.station != null"> 
        AND station = #{condition.station}
    </if>
    <if test="condition.totalQty != null"> 
        AND totalQty = #{condition.totalQty}
    </if>
    <if test="condition.totalLines != null"> 
        AND totalLines = #{condition.totalLines}
    </if>
    <if test="condition.remark != null"> 
        AND remark = #{condition.remark}
    </if>
    <if test="condition.uploadremark != null"> 
        AND uploadremark = #{condition.uploadremark}
    </if>
    <if test="condition.uploadTime != null"> 
        AND uploadTime = #{condition.uploadTime}
    </if>
    <if test="condition.appointmentTime != null"> 
        AND appointmentTime = #{condition.appointmentTime}
    </if>
    <if test="condition.firstStatus != null"> 
        AND firstStatus = #{condition.firstStatus}
    </if>
    <if test="condition.lastStatus != null"> 
        AND lastStatus = #{condition.lastStatus}
    </if>
    <if test="condition.uploadStatus != null"> 
        AND uploadStatus = #{condition.uploadStatus}
    </if>
    <if test="condition.created != null"> 
        AND created = #{condition.created}
    </if>
    <if test="condition.createdBy != null"> 
        AND createdBy = #{condition.createdBy}
    </if>
    <if test="condition.lastUpdated != null"> 
        AND lastUpdated = #{condition.lastUpdated}
    </if>
    <if test="condition.lastUpdatedBy != null"> 
        AND lastUpdatedBy = #{condition.lastUpdatedBy}
    </if>
    <if test="condition.enable != null"> 
        AND enable = #{condition.enable}
    </if>
    <if test="condition.deleted != null"> 
        AND deleted = #{condition.deleted}
    </if>
    <if test="condition.userDef1 != null"> 
        AND userDef1 = #{condition.userDef1}
    </if>
    <if test="condition.userDef2 != null"> 
        AND userDef2 = #{condition.userDef2}
    </if>
    <if test="condition.userDef3 != null"> 
        AND userDef3 = #{condition.userDef3}
    </if>
  </where>
  </update>

  <delete id="deleteById"> 
  DELETE FROM shipment_header WHERE id = #{id, jdbcType=INTEGER} 
  </delete>

  <delete id="deleteByCondition"> 
  DELETE FROM shipment_header 
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="code != null"> 
        AND code = #{code}
    </if>
    <if test="warehouseId != null"> 
        AND warehouseId = #{warehouseId}
    </if>
    <if test="warehouseCode != null"> 
        AND warehouseCode = #{warehouseCode}
    </if>
    <if test="companyId != null"> 
        AND companyId = #{companyId}
    </if>
    <if test="companyCode != null"> 
        AND companyCode = #{companyCode}
    </if>
    <if test="sourceCode != null"> 
        AND sourceCode = #{sourceCode}
    </if>
    <if test="sourcePlatform != null"> 
        AND sourcePlatform = #{sourcePlatform}
    </if>
    <if test="type != null"> 
        AND type = #{type}
    </if>
    <if test="shipTo != null"> 
        AND shipTo = #{shipTo}
    </if>
    <if test="priority != null"> 
        AND priority = #{priority}
    </if>
    <if test="station != null"> 
        AND station = #{station}
    </if>
    <if test="totalQty != null"> 
        AND totalQty = #{totalQty}
    </if>
    <if test="totalLines != null"> 
        AND totalLines = #{totalLines}
    </if>
    <if test="remark != null"> 
        AND remark = #{remark}
    </if>
    <if test="uploadremark != null"> 
        AND uploadremark = #{uploadremark}
    </if>
    <if test="uploadTime != null"> 
        AND uploadTime = #{uploadTime}
    </if>
    <if test="appointmentTime != null"> 
        AND appointmentTime = #{appointmentTime}
    </if>
    <if test="firstStatus != null"> 
        AND firstStatus = #{firstStatus}
    </if>
    <if test="lastStatus != null"> 
        AND lastStatus = #{lastStatus}
    </if>
    <if test="uploadStatus != null"> 
        AND uploadStatus = #{uploadStatus}
    </if>
    <if test="created != null"> 
        AND created = #{created}
    </if>
    <if test="createdBy != null"> 
        AND createdBy = #{createdBy}
    </if>
    <if test="lastUpdated != null"> 
        AND lastUpdated = #{lastUpdated}
    </if>
    <if test="lastUpdatedBy != null"> 
        AND lastUpdatedBy = #{lastUpdatedBy}
    </if>
    <if test="enable != null"> 
        AND enable = #{enable}
    </if>
    <if test="deleted != null"> 
        AND deleted = #{deleted}
    </if>
    <if test="userDef1 != null"> 
        AND userDef1 = #{userDef1}
    </if>
    <if test="userDef2 != null"> 
        AND userDef2 = #{userDef2}
    </if>
    <if test="userDef3 != null"> 
        AND userDef3 = #{userDef3}
    </if>
  </where>
  </delete>

  </mapper>