<?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.receipt.receiptHeader.mapper.ReceiptHeaderMapperAuto">
  <select id="selectListEntityByLike" resultType="com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader">
   SELECT id, code, warehouseId, warehouseCode, companyId, companyCode, type, sourceCode, sourcePlatform, supplierId, supplierCode, totalQty, totalLines, remark, uploadStatus, uploadremark, uploadTime, appointmentTime, firstStatus, lastStatus, created, createdBy, lastUpdated, lastUpdatedBy, enable, deleted, userDef1, userDef2, userDef3  
   FROM receipt_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="type != null and type != ''"> 
        <bind name="typePattern" value="'%' + type + '%'" />
        AND type like #{typePattern}
    </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="supplierId != null "> 
        AND supplierId = #{supplierId}
    </if>
    <if test="supplierCode != null "> 
        AND supplierCode = #{supplierCode}
    </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="uploadStatus != null "> 
        AND uploadStatus = #{uploadStatus}
    </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="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.receipt.receiptHeader.domain.ReceiptHeader">
   SELECT id, code, warehouseId, warehouseCode, companyId, companyCode, type, sourceCode, sourcePlatform, supplierId, supplierCode, totalQty, totalLines, remark, uploadStatus, uploadremark, uploadTime, appointmentTime, firstStatus, lastStatus, created, createdBy, lastUpdated, lastUpdatedBy, enable, deleted, userDef1, userDef2, userDef3  
   FROM receipt_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="type != null"> 
        AND type = #{type}
    </if>
    <if test="sourceCode != null"> 
        AND sourceCode = #{sourceCode}
    </if>
    <if test="sourcePlatform != null"> 
        AND sourcePlatform = #{sourcePlatform}
    </if>
    <if test="supplierId != null"> 
        AND supplierId = #{supplierId}
    </if>
    <if test="supplierCode != null"> 
        AND supplierCode = #{supplierCode}
    </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="uploadStatus != null"> 
        AND uploadStatus = #{uploadStatus}
    </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="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 receipt_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.type != null"> 
        AND type = #{condition.type}
    </if>
    <if test="condition.sourceCode != null"> 
        AND sourceCode = #{condition.sourceCode}
    </if>
    <if test="condition.sourcePlatform != null"> 
        AND sourcePlatform = #{condition.sourcePlatform}
    </if>
    <if test="condition.supplierId != null"> 
        AND supplierId = #{condition.supplierId}
    </if>
    <if test="condition.supplierCode != null"> 
        AND supplierCode = #{condition.supplierCode}
    </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.uploadStatus != null"> 
        AND uploadStatus = #{condition.uploadStatus}
    </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.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.receipt.receiptHeader.domain.ReceiptHeader">
      SELECT id, code, warehouseId, warehouseCode, companyId, companyCode, type, sourceCode, sourcePlatform, supplierId, supplierCode, totalQty, totalLines, remark, uploadStatus, uploadremark, uploadTime, appointmentTime, firstStatus, lastStatus, created, createdBy, lastUpdated, lastUpdatedBy, enable, deleted, userDef1, userDef2, userDef3  FROM receipt_header WHERE id = #{id}
  </select>

  <select id="selectFirstEntity" resultType="com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader">
  SELECT id, code, warehouseId, warehouseCode, companyId, companyCode, type, sourceCode, sourcePlatform, supplierId, supplierCode, totalQty, totalLines, remark, uploadStatus, uploadremark, uploadTime, appointmentTime, firstStatus, lastStatus, created, createdBy, lastUpdated, lastUpdatedBy, enable, deleted, userDef1, userDef2, userDef3  
  FROM receipt_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="type != null"> 
        AND type = #{type}
    </if>
    <if test="sourceCode != null"> 
        AND sourceCode = #{sourceCode}
    </if>
    <if test="sourcePlatform != null"> 
        AND sourcePlatform = #{sourcePlatform}
    </if>
    <if test="supplierId != null"> 
        AND supplierId = #{supplierId}
    </if>
    <if test="supplierCode != null"> 
        AND supplierCode = #{supplierCode}
    </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="uploadStatus != null"> 
        AND uploadStatus = #{uploadStatus}
    </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="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 receipt_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.type != null"> 
        AND type = #{condition.type}
    </if>
    <if test="condition.sourceCode != null"> 
        AND sourceCode = #{condition.sourceCode}
    </if>
    <if test="condition.sourcePlatform != null"> 
        AND sourcePlatform = #{condition.sourcePlatform}
    </if>
    <if test="condition.supplierId != null"> 
        AND supplierId = #{condition.supplierId}
    </if>
    <if test="condition.supplierCode != null"> 
        AND supplierCode = #{condition.supplierCode}
    </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.uploadStatus != null"> 
        AND uploadStatus = #{condition.uploadStatus}
    </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.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.receipt.receiptHeader.domain.ReceiptHeader" keyProperty="id" useGeneratedKeys="true" >
  INSERT INTO receipt_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="type != null"> 
        type, 
    </if>
    <if test="sourceCode != null"> 
        sourceCode, 
    </if>
    <if test="sourcePlatform != null"> 
        sourcePlatform, 
    </if>
    <if test="supplierId != null"> 
        supplierId, 
    </if>
    <if test="supplierCode != null"> 
        supplierCode, 
    </if>
    <if test="totalQty != null"> 
        totalQty, 
    </if>
    <if test="totalLines != null"> 
        totalLines, 
    </if>
    <if test="remark != null"> 
        remark, 
    </if>
    <if test="uploadStatus != null"> 
        uploadStatus, 
    </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="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="type != null"> 
        #{type, jdbcType=VARCHAR}, 
    </if>
    <if test="sourceCode != null"> 
        #{sourceCode, jdbcType=VARCHAR}, 
    </if>
    <if test="sourcePlatform != null"> 
        #{sourcePlatform, jdbcType=VARCHAR}, 
    </if>
    <if test="supplierId != null"> 
        #{supplierId, jdbcType=INTEGER}, 
    </if>
    <if test="supplierCode != null"> 
        #{supplierCode, jdbcType=INTEGER}, 
    </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="uploadStatus != null"> 
        #{uploadStatus, jdbcType=SMALLINT}, 
    </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="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 receipt_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="type != null"> 
        type = #{type, jdbcType=VARCHAR}, 
    </if>
    <if test="sourceCode != null"> 
        sourceCode = #{sourceCode, jdbcType=VARCHAR}, 
    </if>
    <if test="sourcePlatform != null"> 
        sourcePlatform = #{sourcePlatform, jdbcType=VARCHAR}, 
    </if>
    <if test="supplierId != null"> 
        supplierId = #{supplierId, jdbcType=INTEGER}, 
    </if>
    <if test="supplierCode != null"> 
        supplierCode = #{supplierCode, jdbcType=INTEGER}, 
    </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="uploadStatus != null"> 
        uploadStatus = #{uploadStatus, jdbcType=SMALLINT}, 
    </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="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 receipt_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.type != null"> 
        type = #{record.type, 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.supplierId != null"> 
        supplierId = #{record.supplierId, jdbcType=INTEGER}, 
    </if>
    <if test="record.supplierCode != null"> 
        supplierCode = #{record.supplierCode, jdbcType=INTEGER}, 
    </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.uploadStatus != null"> 
        uploadStatus = #{record.uploadStatus, jdbcType=SMALLINT}, 
    </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.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.type != null"> 
        AND type = #{condition.type}
    </if>
    <if test="condition.sourceCode != null"> 
        AND sourceCode = #{condition.sourceCode}
    </if>
    <if test="condition.sourcePlatform != null"> 
        AND sourcePlatform = #{condition.sourcePlatform}
    </if>
    <if test="condition.supplierId != null"> 
        AND supplierId = #{condition.supplierId}
    </if>
    <if test="condition.supplierCode != null"> 
        AND supplierCode = #{condition.supplierCode}
    </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.uploadStatus != null"> 
        AND uploadStatus = #{condition.uploadStatus}
    </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.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 receipt_header WHERE id = #{id, jdbcType=INTEGER} 
  </delete>

  <delete id="deleteByCondition"> 
  DELETE FROM receipt_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="type != null"> 
        AND type = #{type}
    </if>
    <if test="sourceCode != null"> 
        AND sourceCode = #{sourceCode}
    </if>
    <if test="sourcePlatform != null"> 
        AND sourcePlatform = #{sourcePlatform}
    </if>
    <if test="supplierId != null"> 
        AND supplierId = #{supplierId}
    </if>
    <if test="supplierCode != null"> 
        AND supplierCode = #{supplierCode}
    </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="uploadStatus != null"> 
        AND uploadStatus = #{uploadStatus}
    </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="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>