<?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.inventory.inventoryTransaction.mapper.InventoryTransactionMapperAuto">
  <select id="selectListEntityByLike" resultType="com.huaheng.pc.inventory.inventoryTransaction.domain.InventoryTransaction">
   SELECT id, warehouseId, warehouseCode, locationId, locationCode, sourceCode, sourceLine, type, companyId, companyCode, materialId, materialName, materialCode, billId, billCode, billDetailId, batch, lot, project, manufactureDate, expirationDate, status, qty, taskQty, costPrice, listPrice, netPrice, created, createdBy, lastUpdated, lastUpdatedBy, userDef1, userDef2, userDef3  
   FROM inventory_transaction
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="warehouseId != null"> 
        AND warehouseId = #{warehouseId}
    </if>
    <if test="warehouseCode != null"> 
        AND warehouseCode like #{warehouseCode}
    </if>
    <if test="locationId != null"> 
        AND locationId = #{locationId}
    </if>
    <if test="locationCode != null"> 
        AND locationCode like #{locationCode}
    </if>
    <if test="sourceCode != null"> 
        AND sourceCode like #{sourceCode}
    </if>
    <if test="sourceLine != null"> 
        AND sourceLine like #{sourceLine}
    </if>
    <if test="type != null"> 
        AND type like #{type}
    </if>
    <if test="companyId != null"> 
        AND companyId = #{companyId}
    </if>
    <if test="companyCode != null"> 
        AND companyCode like #{companyCode}
    </if>
    <if test="materialId != null"> 
        AND materialId = #{materialId}
    </if>
    <if test="materialName != null"> 
        AND materialName like #{materialName}
    </if>
    <if test="materialCode != null"> 
        AND materialCode like #{materialCode}
    </if>
    <if test="billId != null"> 
        AND billId = #{billId}
    </if>
    <if test="billCode != null"> 
        AND billCode like #{billCode}
    </if>
    <if test="billDetailId != null"> 
        AND billDetailId = #{billDetailId}
    </if>
    <if test="batch != null"> 
        AND batch like #{batch}
    </if>
    <if test="lot != null"> 
        AND lot like #{lot}
    </if>
    <if test="project != null"> 
        AND project like #{project}
    </if>
    <if test="manufactureDate != null"> 
        AND manufactureDate = #{manufactureDate}
    </if>
    <if test="expirationDate != null"> 
        AND expirationDate = #{expirationDate}
    </if>
    <if test="status != null"> 
        AND status like #{status}
    </if>
    <if test="qty != null"> 
        AND qty = #{qty}
    </if>
    <if test="taskQty != null"> 
        AND taskQty = #{taskQty}
    </if>
    <if test="costPrice != null"> 
        AND costPrice = #{costPrice}
    </if>
    <if test="listPrice != null"> 
        AND listPrice = #{listPrice}
    </if>
    <if test="netPrice != null"> 
        AND netPrice = #{netPrice}
    </if>
    <if test="created != null"> 
        AND created = #{created}
    </if>
    <if test="createdBy != null"> 
        AND createdBy like #{createdBy}
    </if>
    <if test="lastUpdated != null"> 
        AND lastUpdated = #{lastUpdated}
    </if>
    <if test="lastUpdatedBy != null"> 
        AND lastUpdatedBy like #{lastUpdatedBy}
    </if>
    <if test="userDef1 != null"> 
        AND userDef1 like #{userDef1}
    </if>
    <if test="userDef2 != null"> 
        AND userDef2 like #{userDef2}
    </if>
    <if test="userDef3 != null"> 
        AND userDef3 like #{userDef3}
    </if>
  </where>
  </select>

  <select id="selectListEntityByEqual" resultType="com.huaheng.pc.inventory.inventoryTransaction.domain.InventoryTransaction">
   SELECT id, warehouseId, warehouseCode, locationId, locationCode, sourceCode, sourceLine, type, companyId, companyCode, materialId, materialName, materialCode, billId, billCode, billDetailId, batch, lot, project, manufactureDate, expirationDate, status, qty, taskQty, costPrice, listPrice, netPrice, created, createdBy, lastUpdated, lastUpdatedBy, userDef1, userDef2, userDef3  
   FROM inventory_transaction
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="warehouseId != null"> 
        AND warehouseId = #{warehouseId}
    </if>
    <if test="warehouseCode != null"> 
        AND warehouseCode = #{warehouseCode}
    </if>
    <if test="locationId != null"> 
        AND locationId = #{locationId}
    </if>
    <if test="locationCode != null"> 
        AND locationCode = #{locationCode}
    </if>
    <if test="sourceCode != null"> 
        AND sourceCode = #{sourceCode}
    </if>
    <if test="sourceLine != null"> 
        AND sourceLine = #{sourceLine}
    </if>
    <if test="type != null"> 
        AND type = #{type}
    </if>
    <if test="companyId != null"> 
        AND companyId = #{companyId}
    </if>
    <if test="companyCode != null"> 
        AND companyCode = #{companyCode}
    </if>
    <if test="materialId != null"> 
        AND materialId = #{materialId}
    </if>
    <if test="materialName != null"> 
        AND materialName = #{materialName}
    </if>
    <if test="materialCode != null"> 
        AND materialCode = #{materialCode}
    </if>
    <if test="billId != null"> 
        AND billId = #{billId}
    </if>
    <if test="billCode != null"> 
        AND billCode = #{billCode}
    </if>
    <if test="billDetailId != null"> 
        AND billDetailId = #{billDetailId}
    </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="status != null"> 
        AND status = #{status}
    </if>
    <if test="qty != null"> 
        AND qty = #{qty}
    </if>
    <if test="taskQty != null"> 
        AND taskQty = #{taskQty}
    </if>
    <if test="costPrice != null"> 
        AND costPrice = #{costPrice}
    </if>
    <if test="listPrice != null"> 
        AND listPrice = #{listPrice}
    </if>
    <if test="netPrice != null"> 
        AND netPrice = #{netPrice}
    </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="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 inventory_transaction
  <where>
    <if test="condition.id != null"> 
        AND id = #{condition.id}
    </if>
    <if test="condition.warehouseId != null"> 
        AND warehouseId = #{condition.warehouseId}
    </if>
    <if test="condition.warehouseCode != null"> 
        AND warehouseCode = #{condition.warehouseCode}
    </if>
    <if test="condition.locationId != null"> 
        AND locationId = #{condition.locationId}
    </if>
    <if test="condition.locationCode != null"> 
        AND locationCode = #{condition.locationCode}
    </if>
    <if test="condition.sourceCode != null"> 
        AND sourceCode = #{condition.sourceCode}
    </if>
    <if test="condition.sourceLine != null"> 
        AND sourceLine = #{condition.sourceLine}
    </if>
    <if test="condition.type != null"> 
        AND type = #{condition.type}
    </if>
    <if test="condition.companyId != null"> 
        AND companyId = #{condition.companyId}
    </if>
    <if test="condition.companyCode != null"> 
        AND companyCode = #{condition.companyCode}
    </if>
    <if test="condition.materialId != null"> 
        AND materialId = #{condition.materialId}
    </if>
    <if test="condition.materialName != null"> 
        AND materialName = #{condition.materialName}
    </if>
    <if test="condition.materialCode != null"> 
        AND materialCode = #{condition.materialCode}
    </if>
    <if test="condition.billId != null"> 
        AND billId = #{condition.billId}
    </if>
    <if test="condition.billCode != null"> 
        AND billCode = #{condition.billCode}
    </if>
    <if test="condition.billDetailId != null"> 
        AND billDetailId = #{condition.billDetailId}
    </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.status != null"> 
        AND status = #{condition.status}
    </if>
    <if test="condition.qty != null"> 
        AND qty = #{condition.qty}
    </if>
    <if test="condition.taskQty != null"> 
        AND taskQty = #{condition.taskQty}
    </if>
    <if test="condition.costPrice != null"> 
        AND costPrice = #{condition.costPrice}
    </if>
    <if test="condition.listPrice != null"> 
        AND listPrice = #{condition.listPrice}
    </if>
    <if test="condition.netPrice != null"> 
        AND netPrice = #{condition.netPrice}
    </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.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.inventory.inventoryTransaction.domain.InventoryTransaction">
      SELECT id, warehouseId, warehouseCode, locationId, locationCode, sourceCode, sourceLine, type, companyId, companyCode, materialId, materialName, materialCode, billId, billCode, billDetailId, batch, lot, project, manufactureDate, expirationDate, status, qty, taskQty, costPrice, listPrice, netPrice, created, createdBy, lastUpdated, lastUpdatedBy, userDef1, userDef2, userDef3  FROM inventory_transaction WHERE id = #{id}
  </select>

  <select id="selectFirstEntity" resultType="com.huaheng.pc.inventory.inventoryTransaction.domain.InventoryTransaction">
  SELECT id, warehouseId, warehouseCode, locationId, locationCode, sourceCode, sourceLine, type, companyId, companyCode, materialId, materialName, materialCode, billId, billCode, billDetailId, batch, lot, project, manufactureDate, expirationDate, status, qty, taskQty, costPrice, listPrice, netPrice, created, createdBy, lastUpdated, lastUpdatedBy, userDef1, userDef2, userDef3  
  FROM inventory_transaction
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="warehouseId != null"> 
        AND warehouseId = #{warehouseId}
    </if>
    <if test="warehouseCode != null"> 
        AND warehouseCode = #{warehouseCode}
    </if>
    <if test="locationId != null"> 
        AND locationId = #{locationId}
    </if>
    <if test="locationCode != null"> 
        AND locationCode = #{locationCode}
    </if>
    <if test="sourceCode != null"> 
        AND sourceCode = #{sourceCode}
    </if>
    <if test="sourceLine != null"> 
        AND sourceLine = #{sourceLine}
    </if>
    <if test="type != null"> 
        AND type = #{type}
    </if>
    <if test="companyId != null"> 
        AND companyId = #{companyId}
    </if>
    <if test="companyCode != null"> 
        AND companyCode = #{companyCode}
    </if>
    <if test="materialId != null"> 
        AND materialId = #{materialId}
    </if>
    <if test="materialName != null"> 
        AND materialName = #{materialName}
    </if>
    <if test="materialCode != null"> 
        AND materialCode = #{materialCode}
    </if>
    <if test="billId != null"> 
        AND billId = #{billId}
    </if>
    <if test="billCode != null"> 
        AND billCode = #{billCode}
    </if>
    <if test="billDetailId != null"> 
        AND billDetailId = #{billDetailId}
    </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="status != null"> 
        AND status = #{status}
    </if>
    <if test="qty != null"> 
        AND qty = #{qty}
    </if>
    <if test="taskQty != null"> 
        AND taskQty = #{taskQty}
    </if>
    <if test="costPrice != null"> 
        AND costPrice = #{costPrice}
    </if>
    <if test="listPrice != null"> 
        AND listPrice = #{listPrice}
    </if>
    <if test="netPrice != null"> 
        AND netPrice = #{netPrice}
    </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="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 inventory_transaction
  <where>
    <if test="condition.id != null"> 
        AND id = #{condition.id}
    </if>
    <if test="condition.warehouseId != null"> 
        AND warehouseId = #{condition.warehouseId}
    </if>
    <if test="condition.warehouseCode != null"> 
        AND warehouseCode = #{condition.warehouseCode}
    </if>
    <if test="condition.locationId != null"> 
        AND locationId = #{condition.locationId}
    </if>
    <if test="condition.locationCode != null"> 
        AND locationCode = #{condition.locationCode}
    </if>
    <if test="condition.sourceCode != null"> 
        AND sourceCode = #{condition.sourceCode}
    </if>
    <if test="condition.sourceLine != null"> 
        AND sourceLine = #{condition.sourceLine}
    </if>
    <if test="condition.type != null"> 
        AND type = #{condition.type}
    </if>
    <if test="condition.companyId != null"> 
        AND companyId = #{condition.companyId}
    </if>
    <if test="condition.companyCode != null"> 
        AND companyCode = #{condition.companyCode}
    </if>
    <if test="condition.materialId != null"> 
        AND materialId = #{condition.materialId}
    </if>
    <if test="condition.materialName != null"> 
        AND materialName = #{condition.materialName}
    </if>
    <if test="condition.materialCode != null"> 
        AND materialCode = #{condition.materialCode}
    </if>
    <if test="condition.billId != null"> 
        AND billId = #{condition.billId}
    </if>
    <if test="condition.billCode != null"> 
        AND billCode = #{condition.billCode}
    </if>
    <if test="condition.billDetailId != null"> 
        AND billDetailId = #{condition.billDetailId}
    </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.status != null"> 
        AND status = #{condition.status}
    </if>
    <if test="condition.qty != null"> 
        AND qty = #{condition.qty}
    </if>
    <if test="condition.taskQty != null"> 
        AND taskQty = #{condition.taskQty}
    </if>
    <if test="condition.costPrice != null"> 
        AND costPrice = #{condition.costPrice}
    </if>
    <if test="condition.listPrice != null"> 
        AND listPrice = #{condition.listPrice}
    </if>
    <if test="condition.netPrice != null"> 
        AND netPrice = #{condition.netPrice}
    </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.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.inventory.inventoryTransaction.domain.InventoryTransaction" keyProperty="id" useGeneratedKeys="true" >
  INSERT INTO inventory_transaction 
  <trim prefix="(" suffix=")" suffixOverrides=",">
    <if test="warehouseId != null"> 
        warehouseId, 
    </if>
    <if test="warehouseCode != null"> 
        warehouseCode, 
    </if>
    <if test="locationId != null"> 
        locationId, 
    </if>
    <if test="locationCode != null"> 
        locationCode, 
    </if>
    <if test="sourceCode != null"> 
        sourceCode, 
    </if>
    <if test="sourceLine != null"> 
        sourceLine, 
    </if>
    <if test="type != null"> 
        type, 
    </if>
    <if test="companyId != null"> 
        companyId, 
    </if>
    <if test="companyCode != null"> 
        companyCode, 
    </if>
    <if test="materialId != null"> 
        materialId, 
    </if>
    <if test="materialName != null"> 
        materialName, 
    </if>
    <if test="materialCode != null"> 
        materialCode, 
    </if>
    <if test="billId != null"> 
        billId, 
    </if>
    <if test="billCode != null"> 
        billCode, 
    </if>
    <if test="billDetailId != null"> 
        billDetailId, 
    </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="status != null"> 
        status, 
    </if>
    <if test="qty != null"> 
        qty, 
    </if>
    <if test="taskQty != null"> 
        taskQty, 
    </if>
    <if test="costPrice != null"> 
        costPrice, 
    </if>
    <if test="listPrice != null"> 
        listPrice, 
    </if>
    <if test="netPrice != null"> 
        netPrice, 
    </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="userDef1 != null"> 
        userDef1, 
    </if>
    <if test="userDef2 != null"> 
        userDef2, 
    </if>
    <if test="userDef3 != null"> 
        userDef3, 
    </if>
  </trim>
  <trim prefix=" values (" suffix=")" suffixOverrides=",">
    <if test="warehouseId != null"> 
        #{warehouseId, jdbcType=INTEGER}, 
    </if>
    <if test="warehouseCode != null"> 
        #{warehouseCode, jdbcType=VARCHAR}, 
    </if>
    <if test="locationId != null"> 
        #{locationId, jdbcType=INTEGER}, 
    </if>
    <if test="locationCode != null"> 
        #{locationCode, jdbcType=VARCHAR}, 
    </if>
    <if test="sourceCode != null"> 
        #{sourceCode, jdbcType=VARCHAR}, 
    </if>
    <if test="sourceLine != null"> 
        #{sourceLine, jdbcType=VARCHAR}, 
    </if>
    <if test="type != null"> 
        #{type, jdbcType=VARCHAR}, 
    </if>
    <if test="companyId != null"> 
        #{companyId, jdbcType=INTEGER}, 
    </if>
    <if test="companyCode != null"> 
        #{companyCode, jdbcType=VARCHAR}, 
    </if>
    <if test="materialId != null"> 
        #{materialId, jdbcType=INTEGER}, 
    </if>
    <if test="materialName != null"> 
        #{materialName, jdbcType=VARCHAR}, 
    </if>
    <if test="materialCode != null"> 
        #{materialCode, jdbcType=VARCHAR}, 
    </if>
    <if test="billId != null"> 
        #{billId, jdbcType=INTEGER}, 
    </if>
    <if test="billCode != null"> 
        #{billCode, jdbcType=VARCHAR}, 
    </if>
    <if test="billDetailId != null"> 
        #{billDetailId, jdbcType=INTEGER}, 
    </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="status != null"> 
        #{status, jdbcType=VARCHAR}, 
    </if>
    <if test="qty != null"> 
        #{qty, jdbcType=DECIMAL}, 
    </if>
    <if test="taskQty != null"> 
        #{taskQty, jdbcType=DECIMAL}, 
    </if>
    <if test="costPrice != null"> 
        #{costPrice, jdbcType=DECIMAL}, 
    </if>
    <if test="listPrice != null"> 
        #{listPrice, jdbcType=DECIMAL}, 
    </if>
    <if test="netPrice != null"> 
        #{netPrice, 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="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 inventory_transaction 
  <set>
    <if test="warehouseId != null"> 
        warehouseId = #{warehouseId, jdbcType=INTEGER}, 
    </if>
    <if test="warehouseCode != null"> 
        warehouseCode = #{warehouseCode, jdbcType=VARCHAR}, 
    </if>
    <if test="locationId != null"> 
        locationId = #{locationId, jdbcType=INTEGER}, 
    </if>
    <if test="locationCode != null"> 
        locationCode = #{locationCode, jdbcType=VARCHAR}, 
    </if>
    <if test="sourceCode != null"> 
        sourceCode = #{sourceCode, jdbcType=VARCHAR}, 
    </if>
    <if test="sourceLine != null"> 
        sourceLine = #{sourceLine, jdbcType=VARCHAR}, 
    </if>
    <if test="type != null"> 
        type = #{type, jdbcType=VARCHAR}, 
    </if>
    <if test="companyId != null"> 
        companyId = #{companyId, jdbcType=INTEGER}, 
    </if>
    <if test="companyCode != null"> 
        companyCode = #{companyCode, jdbcType=VARCHAR}, 
    </if>
    <if test="materialId != null"> 
        materialId = #{materialId, jdbcType=INTEGER}, 
    </if>
    <if test="materialName != null"> 
        materialName = #{materialName, jdbcType=VARCHAR}, 
    </if>
    <if test="materialCode != null"> 
        materialCode = #{materialCode, jdbcType=VARCHAR}, 
    </if>
    <if test="billId != null"> 
        billId = #{billId, jdbcType=INTEGER}, 
    </if>
    <if test="billCode != null"> 
        billCode = #{billCode, jdbcType=VARCHAR}, 
    </if>
    <if test="billDetailId != null"> 
        billDetailId = #{billDetailId, jdbcType=INTEGER}, 
    </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="status != null"> 
        status = #{status, jdbcType=VARCHAR}, 
    </if>
    <if test="qty != null"> 
        qty = #{qty, jdbcType=DECIMAL}, 
    </if>
    <if test="taskQty != null"> 
        taskQty = #{taskQty, jdbcType=DECIMAL}, 
    </if>
    <if test="costPrice != null"> 
        costPrice = #{costPrice, jdbcType=DECIMAL}, 
    </if>
    <if test="listPrice != null"> 
        listPrice = #{listPrice, jdbcType=DECIMAL}, 
    </if>
    <if test="netPrice != null"> 
        netPrice = #{netPrice, 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="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 inventory_transaction 
  <set>
    <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.locationId != null"> 
        locationId = #{record.locationId, jdbcType=INTEGER}, 
    </if>
    <if test="record.locationCode != null"> 
        locationCode = #{record.locationCode, jdbcType=VARCHAR}, 
    </if>
    <if test="record.sourceCode != null"> 
        sourceCode = #{record.sourceCode, jdbcType=VARCHAR}, 
    </if>
    <if test="record.sourceLine != null"> 
        sourceLine = #{record.sourceLine, jdbcType=VARCHAR}, 
    </if>
    <if test="record.type != null"> 
        type = #{record.type, 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.materialId != null"> 
        materialId = #{record.materialId, jdbcType=INTEGER}, 
    </if>
    <if test="record.materialName != null"> 
        materialName = #{record.materialName, jdbcType=VARCHAR}, 
    </if>
    <if test="record.materialCode != null"> 
        materialCode = #{record.materialCode, jdbcType=VARCHAR}, 
    </if>
    <if test="record.billId != null"> 
        billId = #{record.billId, jdbcType=INTEGER}, 
    </if>
    <if test="record.billCode != null"> 
        billCode = #{record.billCode, jdbcType=VARCHAR}, 
    </if>
    <if test="record.billDetailId != null"> 
        billDetailId = #{record.billDetailId, jdbcType=INTEGER}, 
    </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.status != null"> 
        status = #{record.status, jdbcType=VARCHAR}, 
    </if>
    <if test="record.qty != null"> 
        qty = #{record.qty, jdbcType=DECIMAL}, 
    </if>
    <if test="record.taskQty != null"> 
        taskQty = #{record.taskQty, jdbcType=DECIMAL}, 
    </if>
    <if test="record.costPrice != null"> 
        costPrice = #{record.costPrice, jdbcType=DECIMAL}, 
    </if>
    <if test="record.listPrice != null"> 
        listPrice = #{record.listPrice, jdbcType=DECIMAL}, 
    </if>
    <if test="record.netPrice != null"> 
        netPrice = #{record.netPrice, 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.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.warehouseId != null"> 
        AND warehouseId = #{condition.warehouseId}
    </if>
    <if test="condition.warehouseCode != null"> 
        AND warehouseCode = #{condition.warehouseCode}
    </if>
    <if test="condition.locationId != null"> 
        AND locationId = #{condition.locationId}
    </if>
    <if test="condition.locationCode != null"> 
        AND locationCode = #{condition.locationCode}
    </if>
    <if test="condition.sourceCode != null"> 
        AND sourceCode = #{condition.sourceCode}
    </if>
    <if test="condition.sourceLine != null"> 
        AND sourceLine = #{condition.sourceLine}
    </if>
    <if test="condition.type != null"> 
        AND type = #{condition.type}
    </if>
    <if test="condition.companyId != null"> 
        AND companyId = #{condition.companyId}
    </if>
    <if test="condition.companyCode != null"> 
        AND companyCode = #{condition.companyCode}
    </if>
    <if test="condition.materialId != null"> 
        AND materialId = #{condition.materialId}
    </if>
    <if test="condition.materialName != null"> 
        AND materialName = #{condition.materialName}
    </if>
    <if test="condition.materialCode != null"> 
        AND materialCode = #{condition.materialCode}
    </if>
    <if test="condition.billId != null"> 
        AND billId = #{condition.billId}
    </if>
    <if test="condition.billCode != null"> 
        AND billCode = #{condition.billCode}
    </if>
    <if test="condition.billDetailId != null"> 
        AND billDetailId = #{condition.billDetailId}
    </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.status != null"> 
        AND status = #{condition.status}
    </if>
    <if test="condition.qty != null"> 
        AND qty = #{condition.qty}
    </if>
    <if test="condition.taskQty != null"> 
        AND taskQty = #{condition.taskQty}
    </if>
    <if test="condition.costPrice != null"> 
        AND costPrice = #{condition.costPrice}
    </if>
    <if test="condition.listPrice != null"> 
        AND listPrice = #{condition.listPrice}
    </if>
    <if test="condition.netPrice != null"> 
        AND netPrice = #{condition.netPrice}
    </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.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 inventory_transaction WHERE id = #{id, jdbcType=INTEGER} 
  </delete>

  <delete id="deleteByCondition"> 
  DELETE FROM inventory_transaction 
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="warehouseId != null"> 
        AND warehouseId = #{warehouseId}
    </if>
    <if test="warehouseCode != null"> 
        AND warehouseCode = #{warehouseCode}
    </if>
    <if test="locationId != null"> 
        AND locationId = #{locationId}
    </if>
    <if test="locationCode != null"> 
        AND locationCode = #{locationCode}
    </if>
    <if test="sourceCode != null"> 
        AND sourceCode = #{sourceCode}
    </if>
    <if test="sourceLine != null"> 
        AND sourceLine = #{sourceLine}
    </if>
    <if test="type != null"> 
        AND type = #{type}
    </if>
    <if test="companyId != null"> 
        AND companyId = #{companyId}
    </if>
    <if test="companyCode != null"> 
        AND companyCode = #{companyCode}
    </if>
    <if test="materialId != null"> 
        AND materialId = #{materialId}
    </if>
    <if test="materialName != null"> 
        AND materialName = #{materialName}
    </if>
    <if test="materialCode != null"> 
        AND materialCode = #{materialCode}
    </if>
    <if test="billId != null"> 
        AND billId = #{billId}
    </if>
    <if test="billCode != null"> 
        AND billCode = #{billCode}
    </if>
    <if test="billDetailId != null"> 
        AND billDetailId = #{billDetailId}
    </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="status != null"> 
        AND status = #{status}
    </if>
    <if test="qty != null"> 
        AND qty = #{qty}
    </if>
    <if test="taskQty != null"> 
        AND taskQty = #{taskQty}
    </if>
    <if test="costPrice != null"> 
        AND costPrice = #{costPrice}
    </if>
    <if test="listPrice != null"> 
        AND listPrice = #{listPrice}
    </if>
    <if test="netPrice != null"> 
        AND netPrice = #{netPrice}
    </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="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>