<?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.receiptDetailHistory.mapper.ReceiptDetailHistoryMapperAuto">
  <select id="selectListEntityByLike" resultType="com.huaheng.pc.receipt.receiptDetailHistory.domain.ReceiptDetailHistory">
   SELECT id, sourceLine, receiptId, warehouseId, warehouseCode, receiptCode, materialId, materialCode, batch, lot, project, manufactureDate, expirationDate, inventoryStatus, qty, price, created, createdBy, lastUpdated, lastUpdatedBy, deleted, userDef1, userDef2, userDef3  
   FROM receipt_detail_history
  <where>
    <if test="id != null "> 
        AND id = #{id}
    </if>
    <if test="sourceLine != null and sourceLine != ''"> 
        <bind name="sourceLinePattern" value="'%' + sourceLine + '%'" />
        AND sourceLine like #{sourceLinePattern}
    </if>
    <if test="receiptId != null "> 
        AND receiptId = #{receiptId}
    </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="receiptCode != null and receiptCode != ''"> 
        <bind name="receiptCodePattern" value="'%' + receiptCode + '%'" />
        AND receiptCode like #{receiptCodePattern}
    </if>
    <if test="materialId != null "> 
        AND materialId = #{materialId}
    </if>
    <if test="materialCode != null and materialCode != ''"> 
        <bind name="materialCodePattern" value="'%' + materialCode + '%'" />
        AND materialCode like #{materialCodePattern}
    </if>
    <if test="batch != null and batch != ''"> 
        <bind name="batchPattern" value="'%' + batch + '%'" />
        AND batch like #{batchPattern}
    </if>
    <if test="lot != null and lot != ''"> 
        <bind name="lotPattern" value="'%' + lot + '%'" />
        AND lot like #{lotPattern}
    </if>
    <if test="project != null and project != ''"> 
        <bind name="projectPattern" value="'%' + project + '%'" />
        AND project like #{projectPattern}
    </if>
    <if test="params != null and params.manufactureDateBegin != null and params.manufactureDateBegin != ''"> 
        AND manufactureDate &gt;= #{params.manufactureDateBegin}
    </if>
    <if test="params != null and params.manufactureDateEnd != null and params.manufactureDateEnd != ''"> 
        AND manufactureDate &lt;= #{params.manufactureDateEnd}
    </if>
    <if test="params != null and params.expirationDateBegin != null and params.expirationDateBegin != ''"> 
        AND expirationDate &gt;= #{params.expirationDateBegin}
    </if>
    <if test="params != null and params.expirationDateEnd != null and params.expirationDateEnd != ''"> 
        AND expirationDate &lt;= #{params.expirationDateEnd}
    </if>
    <if test="inventoryStatus != null and inventoryStatus != ''"> 
        <bind name="inventoryStatusPattern" value="'%' + inventoryStatus + '%'" />
        AND inventoryStatus like #{inventoryStatusPattern}
    </if>
    <if test="qty != null "> 
        AND qty = #{qty}
    </if>
    <if test="price != null "> 
        AND price = #{price}
    </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="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.receiptDetailHistory.domain.ReceiptDetailHistory">
   SELECT id, sourceLine, receiptId, warehouseId, warehouseCode, receiptCode, materialId, materialCode, batch, lot, project, manufactureDate, expirationDate, inventoryStatus, qty, price, created, createdBy, lastUpdated, lastUpdatedBy, deleted, userDef1, userDef2, userDef3  
   FROM receipt_detail_history
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="sourceLine != null"> 
        AND sourceLine = #{sourceLine}
    </if>
    <if test="receiptId != null"> 
        AND receiptId = #{receiptId}
    </if>
    <if test="warehouseId != null"> 
        AND warehouseId = #{warehouseId}
    </if>
    <if test="warehouseCode != null"> 
        AND warehouseCode = #{warehouseCode}
    </if>
    <if test="receiptCode != null"> 
        AND receiptCode = #{receiptCode}
    </if>
    <if test="materialId != null"> 
        AND materialId = #{materialId}
    </if>
    <if test="materialCode != null"> 
        AND materialCode = #{materialCode}
    </if>
    <if test="batch != null"> 
        AND batch = #{batch}
    </if>
    <if test="lot != null"> 
        AND lot = #{lot}
    </if>
    <if test="project != null"> 
        AND project = #{project}
    </if>
    <if test="manufactureDate != null"> 
        AND manufactureDate = #{manufactureDate}
    </if>
    <if test="expirationDate != null"> 
        AND expirationDate = #{expirationDate}
    </if>
    <if test="inventoryStatus != null"> 
        AND inventoryStatus = #{inventoryStatus}
    </if>
    <if test="qty != null"> 
        AND qty = #{qty}
    </if>
    <if test="price != null"> 
        AND price = #{price}
    </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="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_detail_history
  <where>
    <if test="condition.id != null"> 
        AND id = #{condition.id}
    </if>
    <if test="condition.sourceLine != null"> 
        AND sourceLine = #{condition.sourceLine}
    </if>
    <if test="condition.receiptId != null"> 
        AND receiptId = #{condition.receiptId}
    </if>
    <if test="condition.warehouseId != null"> 
        AND warehouseId = #{condition.warehouseId}
    </if>
    <if test="condition.warehouseCode != null"> 
        AND warehouseCode = #{condition.warehouseCode}
    </if>
    <if test="condition.receiptCode != null"> 
        AND receiptCode = #{condition.receiptCode}
    </if>
    <if test="condition.materialId != null"> 
        AND materialId = #{condition.materialId}
    </if>
    <if test="condition.materialCode != null"> 
        AND materialCode = #{condition.materialCode}
    </if>
    <if test="condition.batch != null"> 
        AND batch = #{condition.batch}
    </if>
    <if test="condition.lot != null"> 
        AND lot = #{condition.lot}
    </if>
    <if test="condition.project != null"> 
        AND project = #{condition.project}
    </if>
    <if test="condition.manufactureDate != null"> 
        AND manufactureDate = #{condition.manufactureDate}
    </if>
    <if test="condition.expirationDate != null"> 
        AND expirationDate = #{condition.expirationDate}
    </if>
    <if test="condition.inventoryStatus != null"> 
        AND inventoryStatus = #{condition.inventoryStatus}
    </if>
    <if test="condition.qty != null"> 
        AND qty = #{condition.qty}
    </if>
    <if test="condition.price != null"> 
        AND price = #{condition.price}
    </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.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.receiptDetailHistory.domain.ReceiptDetailHistory">
      SELECT id, sourceLine, receiptId, warehouseId, warehouseCode, receiptCode, materialId, materialCode, batch, lot, project, manufactureDate, expirationDate, inventoryStatus, qty, price, created, createdBy, lastUpdated, lastUpdatedBy, deleted, userDef1, userDef2, userDef3  FROM receipt_detail_history WHERE id = #{id}
  </select>

  <select id="selectFirstEntity" resultType="com.huaheng.pc.receipt.receiptDetailHistory.domain.ReceiptDetailHistory">
  SELECT id, sourceLine, receiptId, warehouseId, warehouseCode, receiptCode, materialId, materialCode, batch, lot, project, manufactureDate, expirationDate, inventoryStatus, qty, price, created, createdBy, lastUpdated, lastUpdatedBy, deleted, userDef1, userDef2, userDef3  
  FROM receipt_detail_history
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="sourceLine != null"> 
        AND sourceLine = #{sourceLine}
    </if>
    <if test="receiptId != null"> 
        AND receiptId = #{receiptId}
    </if>
    <if test="warehouseId != null"> 
        AND warehouseId = #{warehouseId}
    </if>
    <if test="warehouseCode != null"> 
        AND warehouseCode = #{warehouseCode}
    </if>
    <if test="receiptCode != null"> 
        AND receiptCode = #{receiptCode}
    </if>
    <if test="materialId != null"> 
        AND materialId = #{materialId}
    </if>
    <if test="materialCode != null"> 
        AND materialCode = #{materialCode}
    </if>
    <if test="batch != null"> 
        AND batch = #{batch}
    </if>
    <if test="lot != null"> 
        AND lot = #{lot}
    </if>
    <if test="project != null"> 
        AND project = #{project}
    </if>
    <if test="manufactureDate != null"> 
        AND manufactureDate = #{manufactureDate}
    </if>
    <if test="expirationDate != null"> 
        AND expirationDate = #{expirationDate}
    </if>
    <if test="inventoryStatus != null"> 
        AND inventoryStatus = #{inventoryStatus}
    </if>
    <if test="qty != null"> 
        AND qty = #{qty}
    </if>
    <if test="price != null"> 
        AND price = #{price}
    </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="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_detail_history
  <where>
    <if test="condition.id != null"> 
        AND id = #{condition.id}
    </if>
    <if test="condition.sourceLine != null"> 
        AND sourceLine = #{condition.sourceLine}
    </if>
    <if test="condition.receiptId != null"> 
        AND receiptId = #{condition.receiptId}
    </if>
    <if test="condition.warehouseId != null"> 
        AND warehouseId = #{condition.warehouseId}
    </if>
    <if test="condition.warehouseCode != null"> 
        AND warehouseCode = #{condition.warehouseCode}
    </if>
    <if test="condition.receiptCode != null"> 
        AND receiptCode = #{condition.receiptCode}
    </if>
    <if test="condition.materialId != null"> 
        AND materialId = #{condition.materialId}
    </if>
    <if test="condition.materialCode != null"> 
        AND materialCode = #{condition.materialCode}
    </if>
    <if test="condition.batch != null"> 
        AND batch = #{condition.batch}
    </if>
    <if test="condition.lot != null"> 
        AND lot = #{condition.lot}
    </if>
    <if test="condition.project != null"> 
        AND project = #{condition.project}
    </if>
    <if test="condition.manufactureDate != null"> 
        AND manufactureDate = #{condition.manufactureDate}
    </if>
    <if test="condition.expirationDate != null"> 
        AND expirationDate = #{condition.expirationDate}
    </if>
    <if test="condition.inventoryStatus != null"> 
        AND inventoryStatus = #{condition.inventoryStatus}
    </if>
    <if test="condition.qty != null"> 
        AND qty = #{condition.qty}
    </if>
    <if test="condition.price != null"> 
        AND price = #{condition.price}
    </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.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.receiptDetailHistory.domain.ReceiptDetailHistory" keyProperty="id" useGeneratedKeys="true" >
  INSERT INTO receipt_detail_history 
  <trim prefix="(" suffix=")" suffixOverrides=",">
    <if test="sourceLine != null"> 
        sourceLine, 
    </if>
    <if test="receiptId != null"> 
        receiptId, 
    </if>
    <if test="warehouseId != null"> 
        warehouseId, 
    </if>
    <if test="warehouseCode != null"> 
        warehouseCode, 
    </if>
    <if test="receiptCode != null"> 
        receiptCode, 
    </if>
    <if test="materialId != null"> 
        materialId, 
    </if>
    <if test="materialCode != null"> 
        materialCode, 
    </if>
    <if test="batch != null"> 
        batch, 
    </if>
    <if test="lot != null"> 
        lot, 
    </if>
    <if test="project != null"> 
        project, 
    </if>
    <if test="manufactureDate != null"> 
        manufactureDate, 
    </if>
    <if test="expirationDate != null"> 
        expirationDate, 
    </if>
    <if test="inventoryStatus != null"> 
        inventoryStatus, 
    </if>
    <if test="qty != null"> 
        qty, 
    </if>
    <if test="price != null"> 
        price, 
    </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="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="sourceLine != null"> 
        #{sourceLine, jdbcType=VARCHAR}, 
    </if>
    <if test="receiptId != null"> 
        #{receiptId, jdbcType=INTEGER}, 
    </if>
    <if test="warehouseId != null"> 
        #{warehouseId, jdbcType=INTEGER}, 
    </if>
    <if test="warehouseCode != null"> 
        #{warehouseCode, jdbcType=VARCHAR}, 
    </if>
    <if test="receiptCode != null"> 
        #{receiptCode, jdbcType=VARCHAR}, 
    </if>
    <if test="materialId != null"> 
        #{materialId, jdbcType=INTEGER}, 
    </if>
    <if test="materialCode != null"> 
        #{materialCode, jdbcType=VARCHAR}, 
    </if>
    <if test="batch != null"> 
        #{batch, jdbcType=VARCHAR}, 
    </if>
    <if test="lot != null"> 
        #{lot, jdbcType=VARCHAR}, 
    </if>
    <if test="project != null"> 
        #{project, jdbcType=VARCHAR}, 
    </if>
    <if test="manufactureDate != null"> 
        #{manufactureDate, jdbcType=TIMESTAMP}, 
    </if>
    <if test="expirationDate != null"> 
        #{expirationDate, jdbcType=TIMESTAMP}, 
    </if>
    <if test="inventoryStatus != null"> 
        #{inventoryStatus, jdbcType=VARCHAR}, 
    </if>
    <if test="qty != null"> 
        #{qty, jdbcType=DECIMAL}, 
    </if>
    <if test="price != null"> 
        #{price, jdbcType=DECIMAL}, 
    </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="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_detail_history 
  <set>
    <if test="sourceLine != null"> 
        sourceLine = #{sourceLine, jdbcType=VARCHAR}, 
    </if>
    <if test="receiptId != null"> 
        receiptId = #{receiptId, jdbcType=INTEGER}, 
    </if>
    <if test="warehouseId != null"> 
        warehouseId = #{warehouseId, jdbcType=INTEGER}, 
    </if>
    <if test="warehouseCode != null"> 
        warehouseCode = #{warehouseCode, jdbcType=VARCHAR}, 
    </if>
    <if test="receiptCode != null"> 
        receiptCode = #{receiptCode, jdbcType=VARCHAR}, 
    </if>
    <if test="materialId != null"> 
        materialId = #{materialId, jdbcType=INTEGER}, 
    </if>
    <if test="materialCode != null"> 
        materialCode = #{materialCode, jdbcType=VARCHAR}, 
    </if>
    <if test="batch != null"> 
        batch = #{batch, jdbcType=VARCHAR}, 
    </if>
    <if test="lot != null"> 
        lot = #{lot, jdbcType=VARCHAR}, 
    </if>
    <if test="project != null"> 
        project = #{project, jdbcType=VARCHAR}, 
    </if>
    <if test="manufactureDate != null"> 
        manufactureDate = #{manufactureDate, jdbcType=TIMESTAMP}, 
    </if>
    <if test="expirationDate != null"> 
        expirationDate = #{expirationDate, jdbcType=TIMESTAMP}, 
    </if>
    <if test="inventoryStatus != null"> 
        inventoryStatus = #{inventoryStatus, jdbcType=VARCHAR}, 
    </if>
    <if test="qty != null"> 
        qty = #{qty, jdbcType=DECIMAL}, 
    </if>
    <if test="price != null"> 
        price = #{price, jdbcType=DECIMAL}, 
    </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="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_detail_history 
  <set>
    <if test="record.sourceLine != null"> 
        sourceLine = #{record.sourceLine, jdbcType=VARCHAR}, 
    </if>
    <if test="record.receiptId != null"> 
        receiptId = #{record.receiptId, jdbcType=INTEGER}, 
    </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.receiptCode != null"> 
        receiptCode = #{record.receiptCode, jdbcType=VARCHAR}, 
    </if>
    <if test="record.materialId != null"> 
        materialId = #{record.materialId, jdbcType=INTEGER}, 
    </if>
    <if test="record.materialCode != null"> 
        materialCode = #{record.materialCode, jdbcType=VARCHAR}, 
    </if>
    <if test="record.batch != null"> 
        batch = #{record.batch, jdbcType=VARCHAR}, 
    </if>
    <if test="record.lot != null"> 
        lot = #{record.lot, jdbcType=VARCHAR}, 
    </if>
    <if test="record.project != null"> 
        project = #{record.project, jdbcType=VARCHAR}, 
    </if>
    <if test="record.manufactureDate != null"> 
        manufactureDate = #{record.manufactureDate, jdbcType=TIMESTAMP}, 
    </if>
    <if test="record.expirationDate != null"> 
        expirationDate = #{record.expirationDate, jdbcType=TIMESTAMP}, 
    </if>
    <if test="record.inventoryStatus != null"> 
        inventoryStatus = #{record.inventoryStatus, jdbcType=VARCHAR}, 
    </if>
    <if test="record.qty != null"> 
        qty = #{record.qty, jdbcType=DECIMAL}, 
    </if>
    <if test="record.price != null"> 
        price = #{record.price, jdbcType=DECIMAL}, 
    </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.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.sourceLine != null"> 
        AND sourceLine = #{condition.sourceLine}
    </if>
    <if test="condition.receiptId != null"> 
        AND receiptId = #{condition.receiptId}
    </if>
    <if test="condition.warehouseId != null"> 
        AND warehouseId = #{condition.warehouseId}
    </if>
    <if test="condition.warehouseCode != null"> 
        AND warehouseCode = #{condition.warehouseCode}
    </if>
    <if test="condition.receiptCode != null"> 
        AND receiptCode = #{condition.receiptCode}
    </if>
    <if test="condition.materialId != null"> 
        AND materialId = #{condition.materialId}
    </if>
    <if test="condition.materialCode != null"> 
        AND materialCode = #{condition.materialCode}
    </if>
    <if test="condition.batch != null"> 
        AND batch = #{condition.batch}
    </if>
    <if test="condition.lot != null"> 
        AND lot = #{condition.lot}
    </if>
    <if test="condition.project != null"> 
        AND project = #{condition.project}
    </if>
    <if test="condition.manufactureDate != null"> 
        AND manufactureDate = #{condition.manufactureDate}
    </if>
    <if test="condition.expirationDate != null"> 
        AND expirationDate = #{condition.expirationDate}
    </if>
    <if test="condition.inventoryStatus != null"> 
        AND inventoryStatus = #{condition.inventoryStatus}
    </if>
    <if test="condition.qty != null"> 
        AND qty = #{condition.qty}
    </if>
    <if test="condition.price != null"> 
        AND price = #{condition.price}
    </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.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_detail_history WHERE id = #{id, jdbcType=INTEGER} 
  </delete>

  <delete id="deleteByCondition"> 
  DELETE FROM receipt_detail_history 
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="sourceLine != null"> 
        AND sourceLine = #{sourceLine}
    </if>
    <if test="receiptId != null"> 
        AND receiptId = #{receiptId}
    </if>
    <if test="warehouseId != null"> 
        AND warehouseId = #{warehouseId}
    </if>
    <if test="warehouseCode != null"> 
        AND warehouseCode = #{warehouseCode}
    </if>
    <if test="receiptCode != null"> 
        AND receiptCode = #{receiptCode}
    </if>
    <if test="materialId != null"> 
        AND materialId = #{materialId}
    </if>
    <if test="materialCode != null"> 
        AND materialCode = #{materialCode}
    </if>
    <if test="batch != null"> 
        AND batch = #{batch}
    </if>
    <if test="lot != null"> 
        AND lot = #{lot}
    </if>
    <if test="project != null"> 
        AND project = #{project}
    </if>
    <if test="manufactureDate != null"> 
        AND manufactureDate = #{manufactureDate}
    </if>
    <if test="expirationDate != null"> 
        AND expirationDate = #{expirationDate}
    </if>
    <if test="inventoryStatus != null"> 
        AND inventoryStatus = #{inventoryStatus}
    </if>
    <if test="qty != null"> 
        AND qty = #{qty}
    </if>
    <if test="price != null"> 
        AND price = #{price}
    </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="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>