<?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.foreverwin.mesnac.meapi.mapper.InventoryMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.foreverwin.mesnac.meapi.model.Inventory">
        <result column="HANDLE" property="handle" />
        <result column="CHANGE_STAMP" property="changeStamp" />
        <result column="SITE" property="site" />
        <result column="INVENTORY_ID" property="inventoryId" />
        <result column="ITEM_BO" property="itemBo" />
        <result column="INVENTORY_CONTEXT_GBO" property="inventoryContextGbo" />
        <result column="DESCRIPTION" property="description" />
        <result column="QTY_ON_HAND" property="qtyOnHand" />
        <result column="ASSY_DATA_TYPE_BO" property="assyDataTypeBo" />
        <result column="USAGE_COUNT" property="usageCount" />
        <result column="MAXIMUM_USAGE" property="maximumUsage" />
        <result column="STATUS_BO" property="statusBo" />
        <result column="ORIGINAL_QTY" property="originalQty" />
        <result column="WORK_CENTER_LOC_BO" property="workCenterLocBo" />
        <result column="WORK_CENTER_LOC_RES" property="workCenterLocRes" />
        <result column="OPERATION_LOC_BO" property="operationLocBo" />
        <result column="OPERATION_LOC_RES" property="operationLocRes" />
        <result column="RESOURCE_LOC_BO" property="resourceLocBo" />
        <result column="RESOURCE_LOC_RES" property="resourceLocRes" />
        <result column="SHOP_ORDER_LOC_BO" property="shopOrderLocBo" />
        <result column="SHOP_ORDER_LOC_RES" property="shopOrderLocRes" />
        <result column="SHOP_ORDER_SET_BY_ERP" property="shopOrderSetByErp" />
        <result column="ORIGINAL_USER_BO" property="originalUserBo" />
        <result column="STORAGE_LOCATION_BO" property="storageLocationBo" />
        <result column="HAS_BEEN_USED" property="hasBeenUsed" />
        <result column="RECEIVE_DATE_TIME" property="receiveDateTime" />
        <result column="CREATED_DATE_TIME" property="createdDateTime" />
        <result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
        <result column="PARTITION_DATE" property="partitionDate" />
        <result column="PARENT_INVENTORY_BO" property="parentInventoryBo" />
        <result column="ERP_INVENTORY" property="erpInventory" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        HANDLE, CHANGE_STAMP, SITE, INVENTORY_ID, ITEM_BO, INVENTORY_CONTEXT_GBO, DESCRIPTION, QTY_ON_HAND, ASSY_DATA_TYPE_BO, USAGE_COUNT, MAXIMUM_USAGE, STATUS_BO, ORIGINAL_QTY, WORK_CENTER_LOC_BO, WORK_CENTER_LOC_RES, OPERATION_LOC_BO, OPERATION_LOC_RES, RESOURCE_LOC_BO, RESOURCE_LOC_RES, SHOP_ORDER_LOC_BO, SHOP_ORDER_LOC_RES, SHOP_ORDER_SET_BY_ERP, ORIGINAL_USER_BO, STORAGE_LOCATION_BO, HAS_BEEN_USED, RECEIVE_DATE_TIME, CREATED_DATE_TIME, MODIFIED_DATE_TIME, PARTITION_DATE, PARENT_INVENTORY_BO, ERP_INVENTORY
    </sql>

    <!-- BaseMapper标准查询/修改/删除 -->

    <select id="selectByMap" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include>
        FROM INVENTORY
        <if test="cm!=null and !cm.isEmpty">
            <where>
                <foreach collection="cm.keys" item="k" separator="AND">
                    <if test="cm[k] != null">
                        ${k} = #{cm[${k}]}
                    </if>
                </foreach>
            </where>
        </if>
    </select>


    <select id="selectOne" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include> FROM INVENTORY
        <where>
            <if test="ew.entity.handle!=null">
              HANDLE=#{ew.handle}
            </if>
            <if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
            <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
            <if test="ew.entity.inventoryId!=null"> AND INVENTORY_ID=#{ew.entity.inventoryId}</if>
            <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
            <if test="ew.entity.inventoryContextGbo!=null"> AND INVENTORY_CONTEXT_GBO=#{ew.entity.inventoryContextGbo}</if>
            <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
            <if test="ew.entity.qtyOnHand!=null"> AND QTY_ON_HAND=#{ew.entity.qtyOnHand}</if>
            <if test="ew.entity.assyDataTypeBo!=null"> AND ASSY_DATA_TYPE_BO=#{ew.entity.assyDataTypeBo}</if>
            <if test="ew.entity.usageCount!=null"> AND USAGE_COUNT=#{ew.entity.usageCount}</if>
            <if test="ew.entity.maximumUsage!=null"> AND MAXIMUM_USAGE=#{ew.entity.maximumUsage}</if>
            <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
            <if test="ew.entity.originalQty!=null"> AND ORIGINAL_QTY=#{ew.entity.originalQty}</if>
            <if test="ew.entity.workCenterLocBo!=null"> AND WORK_CENTER_LOC_BO=#{ew.entity.workCenterLocBo}</if>
            <if test="ew.entity.workCenterLocRes!=null"> AND WORK_CENTER_LOC_RES=#{ew.entity.workCenterLocRes}</if>
            <if test="ew.entity.operationLocBo!=null"> AND OPERATION_LOC_BO=#{ew.entity.operationLocBo}</if>
            <if test="ew.entity.operationLocRes!=null"> AND OPERATION_LOC_RES=#{ew.entity.operationLocRes}</if>
            <if test="ew.entity.resourceLocBo!=null"> AND RESOURCE_LOC_BO=#{ew.entity.resourceLocBo}</if>
            <if test="ew.entity.resourceLocRes!=null"> AND RESOURCE_LOC_RES=#{ew.entity.resourceLocRes}</if>
            <if test="ew.entity.shopOrderLocBo!=null"> AND SHOP_ORDER_LOC_BO=#{ew.entity.shopOrderLocBo}</if>
            <if test="ew.entity.shopOrderLocRes!=null"> AND SHOP_ORDER_LOC_RES=#{ew.entity.shopOrderLocRes}</if>
            <if test="ew.entity.shopOrderSetByErp!=null"> AND SHOP_ORDER_SET_BY_ERP=#{ew.entity.shopOrderSetByErp}</if>
            <if test="ew.entity.originalUserBo!=null"> AND ORIGINAL_USER_BO=#{ew.entity.originalUserBo}</if>
            <if test="ew.entity.storageLocationBo!=null"> AND STORAGE_LOCATION_BO=#{ew.entity.storageLocationBo}</if>
            <if test="ew.entity.hasBeenUsed!=null"> AND HAS_BEEN_USED=#{ew.entity.hasBeenUsed}</if>
            <if test="ew.entity.receiveDateTime!=null"> AND RECEIVE_DATE_TIME=#{ew.entity.receiveDateTime}</if>
            <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
            <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
            <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
            <if test="ew.entity.parentInventoryBo!=null"> AND PARENT_INVENTORY_BO=#{ew.entity.parentInventoryBo}</if>
            <if test="ew.entity.erpInventory!=null"> AND ERP_INVENTORY=#{ew.entity.erpInventory}</if>
        </where>
    </select>

    <select id="selectCount" resultType="Integer">
        SELECT COUNT(1) FROM INVENTORY
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                <if test="ew.entity.handle!=null">
                    HANDLE=#{ew.entity.handle}
                </if>
                <if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
                <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                <if test="ew.entity.inventoryId!=null"> AND INVENTORY_ID=#{ew.entity.inventoryId}</if>
                <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                <if test="ew.entity.inventoryContextGbo!=null"> AND INVENTORY_CONTEXT_GBO=#{ew.entity.inventoryContextGbo}</if>
                <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
                <if test="ew.entity.qtyOnHand!=null"> AND QTY_ON_HAND=#{ew.entity.qtyOnHand}</if>
                <if test="ew.entity.assyDataTypeBo!=null"> AND ASSY_DATA_TYPE_BO=#{ew.entity.assyDataTypeBo}</if>
                <if test="ew.entity.usageCount!=null"> AND USAGE_COUNT=#{ew.entity.usageCount}</if>
                <if test="ew.entity.maximumUsage!=null"> AND MAXIMUM_USAGE=#{ew.entity.maximumUsage}</if>
                <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                <if test="ew.entity.originalQty!=null"> AND ORIGINAL_QTY=#{ew.entity.originalQty}</if>
                <if test="ew.entity.workCenterLocBo!=null"> AND WORK_CENTER_LOC_BO=#{ew.entity.workCenterLocBo}</if>
                <if test="ew.entity.workCenterLocRes!=null"> AND WORK_CENTER_LOC_RES=#{ew.entity.workCenterLocRes}</if>
                <if test="ew.entity.operationLocBo!=null"> AND OPERATION_LOC_BO=#{ew.entity.operationLocBo}</if>
                <if test="ew.entity.operationLocRes!=null"> AND OPERATION_LOC_RES=#{ew.entity.operationLocRes}</if>
                <if test="ew.entity.resourceLocBo!=null"> AND RESOURCE_LOC_BO=#{ew.entity.resourceLocBo}</if>
                <if test="ew.entity.resourceLocRes!=null"> AND RESOURCE_LOC_RES=#{ew.entity.resourceLocRes}</if>
                <if test="ew.entity.shopOrderLocBo!=null"> AND SHOP_ORDER_LOC_BO=#{ew.entity.shopOrderLocBo}</if>
                <if test="ew.entity.shopOrderLocRes!=null"> AND SHOP_ORDER_LOC_RES=#{ew.entity.shopOrderLocRes}</if>
                <if test="ew.entity.shopOrderSetByErp!=null"> AND SHOP_ORDER_SET_BY_ERP=#{ew.entity.shopOrderSetByErp}</if>
                <if test="ew.entity.originalUserBo!=null"> AND ORIGINAL_USER_BO=#{ew.entity.originalUserBo}</if>
                <if test="ew.entity.storageLocationBo!=null"> AND STORAGE_LOCATION_BO=#{ew.entity.storageLocationBo}</if>
                <if test="ew.entity.hasBeenUsed!=null"> AND HAS_BEEN_USED=#{ew.entity.hasBeenUsed}</if>
                <if test="ew.entity.receiveDateTime!=null"> AND RECEIVE_DATE_TIME=#{ew.entity.receiveDateTime}</if>
                <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
                <if test="ew.entity.parentInventoryBo!=null"> AND PARENT_INVENTORY_BO=#{ew.entity.parentInventoryBo}</if>
                <if test="ew.entity.erpInventory!=null"> AND ERP_INVENTORY=#{ew.entity.erpInventory}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            ${ew.sqlSegment}
        </if>
    </select>

    <select id="selectList" resultMap="BaseResultMap">
        SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM INVENTORY
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.inventoryId!=null"> AND INVENTORY_ID=#{ew.entity.inventoryId}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.inventoryContextGbo!=null"> AND INVENTORY_CONTEXT_GBO=#{ew.entity.inventoryContextGbo}</if>
                    <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
                    <if test="ew.entity.qtyOnHand!=null"> AND QTY_ON_HAND=#{ew.entity.qtyOnHand}</if>
                    <if test="ew.entity.assyDataTypeBo!=null"> AND ASSY_DATA_TYPE_BO=#{ew.entity.assyDataTypeBo}</if>
                    <if test="ew.entity.usageCount!=null"> AND USAGE_COUNT=#{ew.entity.usageCount}</if>
                    <if test="ew.entity.maximumUsage!=null"> AND MAXIMUM_USAGE=#{ew.entity.maximumUsage}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.originalQty!=null"> AND ORIGINAL_QTY=#{ew.entity.originalQty}</if>
                    <if test="ew.entity.workCenterLocBo!=null"> AND WORK_CENTER_LOC_BO=#{ew.entity.workCenterLocBo}</if>
                    <if test="ew.entity.workCenterLocRes!=null"> AND WORK_CENTER_LOC_RES=#{ew.entity.workCenterLocRes}</if>
                    <if test="ew.entity.operationLocBo!=null"> AND OPERATION_LOC_BO=#{ew.entity.operationLocBo}</if>
                    <if test="ew.entity.operationLocRes!=null"> AND OPERATION_LOC_RES=#{ew.entity.operationLocRes}</if>
                    <if test="ew.entity.resourceLocBo!=null"> AND RESOURCE_LOC_BO=#{ew.entity.resourceLocBo}</if>
                    <if test="ew.entity.resourceLocRes!=null"> AND RESOURCE_LOC_RES=#{ew.entity.resourceLocRes}</if>
                    <if test="ew.entity.shopOrderLocBo!=null"> AND SHOP_ORDER_LOC_BO=#{ew.entity.shopOrderLocBo}</if>
                    <if test="ew.entity.shopOrderLocRes!=null"> AND SHOP_ORDER_LOC_RES=#{ew.entity.shopOrderLocRes}</if>
                    <if test="ew.entity.shopOrderSetByErp!=null"> AND SHOP_ORDER_SET_BY_ERP=#{ew.entity.shopOrderSetByErp}</if>
                    <if test="ew.entity.originalUserBo!=null"> AND ORIGINAL_USER_BO=#{ew.entity.originalUserBo}</if>
                    <if test="ew.entity.storageLocationBo!=null"> AND STORAGE_LOCATION_BO=#{ew.entity.storageLocationBo}</if>
                    <if test="ew.entity.hasBeenUsed!=null"> AND HAS_BEEN_USED=#{ew.entity.hasBeenUsed}</if>
                    <if test="ew.entity.receiveDateTime!=null"> AND RECEIVE_DATE_TIME=#{ew.entity.receiveDateTime}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
                    <if test="ew.entity.parentInventoryBo!=null"> AND PARENT_INVENTORY_BO=#{ew.entity.parentInventoryBo}</if>
                    <if test="ew.entity.erpInventory!=null"> AND ERP_INVENTORY=#{ew.entity.erpInventory}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            ${ew.sqlSegment}
        </if>
    </select>

    <select id="selectMaps" resultType="HashMap">
        SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM INVENTORY
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.inventoryId!=null"> AND INVENTORY_ID=#{ew.entity.inventoryId}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.inventoryContextGbo!=null"> AND INVENTORY_CONTEXT_GBO=#{ew.entity.inventoryContextGbo}</if>
                    <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
                    <if test="ew.entity.qtyOnHand!=null"> AND QTY_ON_HAND=#{ew.entity.qtyOnHand}</if>
                    <if test="ew.entity.assyDataTypeBo!=null"> AND ASSY_DATA_TYPE_BO=#{ew.entity.assyDataTypeBo}</if>
                    <if test="ew.entity.usageCount!=null"> AND USAGE_COUNT=#{ew.entity.usageCount}</if>
                    <if test="ew.entity.maximumUsage!=null"> AND MAXIMUM_USAGE=#{ew.entity.maximumUsage}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.originalQty!=null"> AND ORIGINAL_QTY=#{ew.entity.originalQty}</if>
                    <if test="ew.entity.workCenterLocBo!=null"> AND WORK_CENTER_LOC_BO=#{ew.entity.workCenterLocBo}</if>
                    <if test="ew.entity.workCenterLocRes!=null"> AND WORK_CENTER_LOC_RES=#{ew.entity.workCenterLocRes}</if>
                    <if test="ew.entity.operationLocBo!=null"> AND OPERATION_LOC_BO=#{ew.entity.operationLocBo}</if>
                    <if test="ew.entity.operationLocRes!=null"> AND OPERATION_LOC_RES=#{ew.entity.operationLocRes}</if>
                    <if test="ew.entity.resourceLocBo!=null"> AND RESOURCE_LOC_BO=#{ew.entity.resourceLocBo}</if>
                    <if test="ew.entity.resourceLocRes!=null"> AND RESOURCE_LOC_RES=#{ew.entity.resourceLocRes}</if>
                    <if test="ew.entity.shopOrderLocBo!=null"> AND SHOP_ORDER_LOC_BO=#{ew.entity.shopOrderLocBo}</if>
                    <if test="ew.entity.shopOrderLocRes!=null"> AND SHOP_ORDER_LOC_RES=#{ew.entity.shopOrderLocRes}</if>
                    <if test="ew.entity.shopOrderSetByErp!=null"> AND SHOP_ORDER_SET_BY_ERP=#{ew.entity.shopOrderSetByErp}</if>
                    <if test="ew.entity.originalUserBo!=null"> AND ORIGINAL_USER_BO=#{ew.entity.originalUserBo}</if>
                    <if test="ew.entity.storageLocationBo!=null"> AND STORAGE_LOCATION_BO=#{ew.entity.storageLocationBo}</if>
                    <if test="ew.entity.hasBeenUsed!=null"> AND HAS_BEEN_USED=#{ew.entity.hasBeenUsed}</if>
                    <if test="ew.entity.receiveDateTime!=null"> AND RECEIVE_DATE_TIME=#{ew.entity.receiveDateTime}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
                    <if test="ew.entity.parentInventoryBo!=null"> AND PARENT_INVENTORY_BO=#{ew.entity.parentInventoryBo}</if>
                    <if test="ew.entity.erpInventory!=null"> AND ERP_INVENTORY=#{ew.entity.erpInventory}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            ${ew.sqlSegment}
        </if>
    </select>

    <select id="selectObjs" resultType="Object">
        SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM INVENTORY
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.inventoryId!=null"> AND INVENTORY_ID=#{ew.entity.inventoryId}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.inventoryContextGbo!=null"> AND INVENTORY_CONTEXT_GBO=#{ew.entity.inventoryContextGbo}</if>
                    <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
                    <if test="ew.entity.qtyOnHand!=null"> AND QTY_ON_HAND=#{ew.entity.qtyOnHand}</if>
                    <if test="ew.entity.assyDataTypeBo!=null"> AND ASSY_DATA_TYPE_BO=#{ew.entity.assyDataTypeBo}</if>
                    <if test="ew.entity.usageCount!=null"> AND USAGE_COUNT=#{ew.entity.usageCount}</if>
                    <if test="ew.entity.maximumUsage!=null"> AND MAXIMUM_USAGE=#{ew.entity.maximumUsage}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.originalQty!=null"> AND ORIGINAL_QTY=#{ew.entity.originalQty}</if>
                    <if test="ew.entity.workCenterLocBo!=null"> AND WORK_CENTER_LOC_BO=#{ew.entity.workCenterLocBo}</if>
                    <if test="ew.entity.workCenterLocRes!=null"> AND WORK_CENTER_LOC_RES=#{ew.entity.workCenterLocRes}</if>
                    <if test="ew.entity.operationLocBo!=null"> AND OPERATION_LOC_BO=#{ew.entity.operationLocBo}</if>
                    <if test="ew.entity.operationLocRes!=null"> AND OPERATION_LOC_RES=#{ew.entity.operationLocRes}</if>
                    <if test="ew.entity.resourceLocBo!=null"> AND RESOURCE_LOC_BO=#{ew.entity.resourceLocBo}</if>
                    <if test="ew.entity.resourceLocRes!=null"> AND RESOURCE_LOC_RES=#{ew.entity.resourceLocRes}</if>
                    <if test="ew.entity.shopOrderLocBo!=null"> AND SHOP_ORDER_LOC_BO=#{ew.entity.shopOrderLocBo}</if>
                    <if test="ew.entity.shopOrderLocRes!=null"> AND SHOP_ORDER_LOC_RES=#{ew.entity.shopOrderLocRes}</if>
                    <if test="ew.entity.shopOrderSetByErp!=null"> AND SHOP_ORDER_SET_BY_ERP=#{ew.entity.shopOrderSetByErp}</if>
                    <if test="ew.entity.originalUserBo!=null"> AND ORIGINAL_USER_BO=#{ew.entity.originalUserBo}</if>
                    <if test="ew.entity.storageLocationBo!=null"> AND STORAGE_LOCATION_BO=#{ew.entity.storageLocationBo}</if>
                    <if test="ew.entity.hasBeenUsed!=null"> AND HAS_BEEN_USED=#{ew.entity.hasBeenUsed}</if>
                    <if test="ew.entity.receiveDateTime!=null"> AND RECEIVE_DATE_TIME=#{ew.entity.receiveDateTime}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
                    <if test="ew.entity.parentInventoryBo!=null"> AND PARENT_INVENTORY_BO=#{ew.entity.parentInventoryBo}</if>
                    <if test="ew.entity.erpInventory!=null"> AND ERP_INVENTORY=#{ew.entity.erpInventory}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            ${ew.sqlSegment}
        </if>
    </select>

    <select id="selectPage" resultMap="BaseResultMap">
        SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM INVENTORY
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.inventoryId!=null"> AND INVENTORY_ID=#{ew.entity.inventoryId}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.inventoryContextGbo!=null"> AND INVENTORY_CONTEXT_GBO=#{ew.entity.inventoryContextGbo}</if>
                    <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
                    <if test="ew.entity.qtyOnHand!=null"> AND QTY_ON_HAND=#{ew.entity.qtyOnHand}</if>
                    <if test="ew.entity.assyDataTypeBo!=null"> AND ASSY_DATA_TYPE_BO=#{ew.entity.assyDataTypeBo}</if>
                    <if test="ew.entity.usageCount!=null"> AND USAGE_COUNT=#{ew.entity.usageCount}</if>
                    <if test="ew.entity.maximumUsage!=null"> AND MAXIMUM_USAGE=#{ew.entity.maximumUsage}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.originalQty!=null"> AND ORIGINAL_QTY=#{ew.entity.originalQty}</if>
                    <if test="ew.entity.workCenterLocBo!=null"> AND WORK_CENTER_LOC_BO=#{ew.entity.workCenterLocBo}</if>
                    <if test="ew.entity.workCenterLocRes!=null"> AND WORK_CENTER_LOC_RES=#{ew.entity.workCenterLocRes}</if>
                    <if test="ew.entity.operationLocBo!=null"> AND OPERATION_LOC_BO=#{ew.entity.operationLocBo}</if>
                    <if test="ew.entity.operationLocRes!=null"> AND OPERATION_LOC_RES=#{ew.entity.operationLocRes}</if>
                    <if test="ew.entity.resourceLocBo!=null"> AND RESOURCE_LOC_BO=#{ew.entity.resourceLocBo}</if>
                    <if test="ew.entity.resourceLocRes!=null"> AND RESOURCE_LOC_RES=#{ew.entity.resourceLocRes}</if>
                    <if test="ew.entity.shopOrderLocBo!=null"> AND SHOP_ORDER_LOC_BO=#{ew.entity.shopOrderLocBo}</if>
                    <if test="ew.entity.shopOrderLocRes!=null"> AND SHOP_ORDER_LOC_RES=#{ew.entity.shopOrderLocRes}</if>
                    <if test="ew.entity.shopOrderSetByErp!=null"> AND SHOP_ORDER_SET_BY_ERP=#{ew.entity.shopOrderSetByErp}</if>
                    <if test="ew.entity.originalUserBo!=null"> AND ORIGINAL_USER_BO=#{ew.entity.originalUserBo}</if>
                    <if test="ew.entity.storageLocationBo!=null"> AND STORAGE_LOCATION_BO=#{ew.entity.storageLocationBo}</if>
                    <if test="ew.entity.hasBeenUsed!=null"> AND HAS_BEEN_USED=#{ew.entity.hasBeenUsed}</if>
                    <if test="ew.entity.receiveDateTime!=null"> AND RECEIVE_DATE_TIME=#{ew.entity.receiveDateTime}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
                    <if test="ew.entity.parentInventoryBo!=null"> AND PARENT_INVENTORY_BO=#{ew.entity.parentInventoryBo}</if>
                    <if test="ew.entity.erpInventory!=null"> AND ERP_INVENTORY=#{ew.entity.erpInventory}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            ${ew.sqlSegment}
        </if>
    </select>

    <select id="selectMapsPage" resultType="HashMap">
        SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM INVENTORY
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.inventoryId!=null"> AND INVENTORY_ID=#{ew.entity.inventoryId}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.inventoryContextGbo!=null"> AND INVENTORY_CONTEXT_GBO=#{ew.entity.inventoryContextGbo}</if>
                    <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
                    <if test="ew.entity.qtyOnHand!=null"> AND QTY_ON_HAND=#{ew.entity.qtyOnHand}</if>
                    <if test="ew.entity.assyDataTypeBo!=null"> AND ASSY_DATA_TYPE_BO=#{ew.entity.assyDataTypeBo}</if>
                    <if test="ew.entity.usageCount!=null"> AND USAGE_COUNT=#{ew.entity.usageCount}</if>
                    <if test="ew.entity.maximumUsage!=null"> AND MAXIMUM_USAGE=#{ew.entity.maximumUsage}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.originalQty!=null"> AND ORIGINAL_QTY=#{ew.entity.originalQty}</if>
                    <if test="ew.entity.workCenterLocBo!=null"> AND WORK_CENTER_LOC_BO=#{ew.entity.workCenterLocBo}</if>
                    <if test="ew.entity.workCenterLocRes!=null"> AND WORK_CENTER_LOC_RES=#{ew.entity.workCenterLocRes}</if>
                    <if test="ew.entity.operationLocBo!=null"> AND OPERATION_LOC_BO=#{ew.entity.operationLocBo}</if>
                    <if test="ew.entity.operationLocRes!=null"> AND OPERATION_LOC_RES=#{ew.entity.operationLocRes}</if>
                    <if test="ew.entity.resourceLocBo!=null"> AND RESOURCE_LOC_BO=#{ew.entity.resourceLocBo}</if>
                    <if test="ew.entity.resourceLocRes!=null"> AND RESOURCE_LOC_RES=#{ew.entity.resourceLocRes}</if>
                    <if test="ew.entity.shopOrderLocBo!=null"> AND SHOP_ORDER_LOC_BO=#{ew.entity.shopOrderLocBo}</if>
                    <if test="ew.entity.shopOrderLocRes!=null"> AND SHOP_ORDER_LOC_RES=#{ew.entity.shopOrderLocRes}</if>
                    <if test="ew.entity.shopOrderSetByErp!=null"> AND SHOP_ORDER_SET_BY_ERP=#{ew.entity.shopOrderSetByErp}</if>
                    <if test="ew.entity.originalUserBo!=null"> AND ORIGINAL_USER_BO=#{ew.entity.originalUserBo}</if>
                    <if test="ew.entity.storageLocationBo!=null"> AND STORAGE_LOCATION_BO=#{ew.entity.storageLocationBo}</if>
                    <if test="ew.entity.hasBeenUsed!=null"> AND HAS_BEEN_USED=#{ew.entity.hasBeenUsed}</if>
                    <if test="ew.entity.receiveDateTime!=null"> AND RECEIVE_DATE_TIME=#{ew.entity.receiveDateTime}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
                    <if test="ew.entity.parentInventoryBo!=null"> AND PARENT_INVENTORY_BO=#{ew.entity.parentInventoryBo}</if>
                    <if test="ew.entity.erpInventory!=null"> AND ERP_INVENTORY=#{ew.entity.erpInventory}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            ${ew.sqlSegment}
        </if>
    </select>

    <insert id="insert" parameterType="com.foreverwin.mesnac.meapi.model.Inventory">
        INSERT INTO INVENTORY
        <trim prefix="(" suffix=")" suffixOverrides=",">
            HANDLE,
            <if test="changeStamp!=null">CHANGE_STAMP,</if>
            <if test="site!=null">SITE,</if>
            <if test="inventoryId!=null">INVENTORY_ID,</if>
            <if test="itemBo!=null">ITEM_BO,</if>
            <if test="inventoryContextGbo!=null">INVENTORY_CONTEXT_GBO,</if>
            <if test="description!=null">DESCRIPTION,</if>
            <if test="qtyOnHand!=null">QTY_ON_HAND,</if>
            <if test="assyDataTypeBo!=null">ASSY_DATA_TYPE_BO,</if>
            <if test="usageCount!=null">USAGE_COUNT,</if>
            <if test="maximumUsage!=null">MAXIMUM_USAGE,</if>
            <if test="statusBo!=null">STATUS_BO,</if>
            <if test="originalQty!=null">ORIGINAL_QTY,</if>
            <if test="workCenterLocBo!=null">WORK_CENTER_LOC_BO,</if>
            <if test="workCenterLocRes!=null">WORK_CENTER_LOC_RES,</if>
            <if test="operationLocBo!=null">OPERATION_LOC_BO,</if>
            <if test="operationLocRes!=null">OPERATION_LOC_RES,</if>
            <if test="resourceLocBo!=null">RESOURCE_LOC_BO,</if>
            <if test="resourceLocRes!=null">RESOURCE_LOC_RES,</if>
            <if test="shopOrderLocBo!=null">SHOP_ORDER_LOC_BO,</if>
            <if test="shopOrderLocRes!=null">SHOP_ORDER_LOC_RES,</if>
            <if test="shopOrderSetByErp!=null">SHOP_ORDER_SET_BY_ERP,</if>
            <if test="originalUserBo!=null">ORIGINAL_USER_BO,</if>
            <if test="storageLocationBo!=null">STORAGE_LOCATION_BO,</if>
            <if test="hasBeenUsed!=null">HAS_BEEN_USED,</if>
            <if test="receiveDateTime!=null">RECEIVE_DATE_TIME,</if>
            <if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
            <if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
            <if test="partitionDate!=null">PARTITION_DATE,</if>
            <if test="parentInventoryBo!=null">PARENT_INVENTORY_BO,</if>
            <if test="erpInventory!=null">ERP_INVENTORY,</if>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            <if test="changeStamp!=null">#{changeStamp},</if>
            <if test="site!=null">#{site},</if>
            <if test="inventoryId!=null">#{inventoryId},</if>
            <if test="itemBo!=null">#{itemBo},</if>
            <if test="inventoryContextGbo!=null">#{inventoryContextGbo},</if>
            <if test="description!=null">#{description},</if>
            <if test="qtyOnHand!=null">#{qtyOnHand},</if>
            <if test="assyDataTypeBo!=null">#{assyDataTypeBo},</if>
            <if test="usageCount!=null">#{usageCount},</if>
            <if test="maximumUsage!=null">#{maximumUsage},</if>
            <if test="statusBo!=null">#{statusBo},</if>
            <if test="originalQty!=null">#{originalQty},</if>
            <if test="workCenterLocBo!=null">#{workCenterLocBo},</if>
            <if test="workCenterLocRes!=null">#{workCenterLocRes},</if>
            <if test="operationLocBo!=null">#{operationLocBo},</if>
            <if test="operationLocRes!=null">#{operationLocRes},</if>
            <if test="resourceLocBo!=null">#{resourceLocBo},</if>
            <if test="resourceLocRes!=null">#{resourceLocRes},</if>
            <if test="shopOrderLocBo!=null">#{shopOrderLocBo},</if>
            <if test="shopOrderLocRes!=null">#{shopOrderLocRes},</if>
            <if test="shopOrderSetByErp!=null">#{shopOrderSetByErp},</if>
            <if test="originalUserBo!=null">#{originalUserBo},</if>
            <if test="storageLocationBo!=null">#{storageLocationBo},</if>
            <if test="hasBeenUsed!=null">#{hasBeenUsed},</if>
            <if test="receiveDateTime!=null">#{receiveDateTime},</if>
            <if test="createdDateTime!=null">#{createdDateTime},</if>
            <if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
            <if test="partitionDate!=null">#{partitionDate},</if>
            <if test="parentInventoryBo!=null">#{parentInventoryBo},</if>
            <if test="erpInventory!=null">#{erpInventory},</if>
        </trim>
    </insert>

    <insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.meapi.model.Inventory">
        INSERT INTO INVENTORY
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <include refid="Base_Column_List"></include>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            #{changeStamp},
            #{site},
            #{inventoryId},
            #{itemBo},
            #{inventoryContextGbo},
            #{description},
            #{qtyOnHand},
            #{assyDataTypeBo},
            #{usageCount},
            #{maximumUsage},
            #{statusBo},
            #{originalQty},
            #{workCenterLocBo},
            #{workCenterLocRes},
            #{operationLocBo},
            #{operationLocRes},
            #{resourceLocBo},
            #{resourceLocRes},
            #{shopOrderLocBo},
            #{shopOrderLocRes},
            #{shopOrderSetByErp},
            #{originalUserBo},
            #{storageLocationBo},
            #{hasBeenUsed},
            #{receiveDateTime},
            #{createdDateTime},
            #{modifiedDateTime},
            #{partitionDate},
            #{parentInventoryBo},
            #{erpInventory},
        </trim>
    </insert>






    <update id="update">
        UPDATE INVENTORY <trim prefix="SET" suffixOverrides=",">
        <if test="et.handle!=null">HANDLE=#{et.handle},</if>
        <if test="et.changeStamp!=null">CHANGE_STAMP=#{et.changeStamp},</if>
        <if test="et.site!=null">SITE=#{et.site},</if>
        <if test="et.inventoryId!=null">INVENTORY_ID=#{et.inventoryId},</if>
        <if test="et.itemBo!=null">ITEM_BO=#{et.itemBo},</if>
        <if test="et.inventoryContextGbo!=null">INVENTORY_CONTEXT_GBO=#{et.inventoryContextGbo},</if>
        <if test="et.description!=null">DESCRIPTION=#{et.description},</if>
        <if test="et.qtyOnHand!=null">QTY_ON_HAND=#{et.qtyOnHand},</if>
        <if test="et.assyDataTypeBo!=null">ASSY_DATA_TYPE_BO=#{et.assyDataTypeBo},</if>
        <if test="et.usageCount!=null">USAGE_COUNT=#{et.usageCount},</if>
        <if test="et.maximumUsage!=null">MAXIMUM_USAGE=#{et.maximumUsage},</if>
        <if test="et.statusBo!=null">STATUS_BO=#{et.statusBo},</if>
        <if test="et.originalQty!=null">ORIGINAL_QTY=#{et.originalQty},</if>
        <if test="et.workCenterLocBo!=null">WORK_CENTER_LOC_BO=#{et.workCenterLocBo},</if>
        <if test="et.workCenterLocRes!=null">WORK_CENTER_LOC_RES=#{et.workCenterLocRes},</if>
        <if test="et.operationLocBo!=null">OPERATION_LOC_BO=#{et.operationLocBo},</if>
        <if test="et.operationLocRes!=null">OPERATION_LOC_RES=#{et.operationLocRes},</if>
        <if test="et.resourceLocBo!=null">RESOURCE_LOC_BO=#{et.resourceLocBo},</if>
        <if test="et.resourceLocRes!=null">RESOURCE_LOC_RES=#{et.resourceLocRes},</if>
        <if test="et.shopOrderLocBo!=null">SHOP_ORDER_LOC_BO=#{et.shopOrderLocBo},</if>
        <if test="et.shopOrderLocRes!=null">SHOP_ORDER_LOC_RES=#{et.shopOrderLocRes},</if>
        <if test="et.shopOrderSetByErp!=null">SHOP_ORDER_SET_BY_ERP=#{et.shopOrderSetByErp},</if>
        <if test="et.originalUserBo!=null">ORIGINAL_USER_BO=#{et.originalUserBo},</if>
        <if test="et.storageLocationBo!=null">STORAGE_LOCATION_BO=#{et.storageLocationBo},</if>
        <if test="et.hasBeenUsed!=null">HAS_BEEN_USED=#{et.hasBeenUsed},</if>
        <if test="et.receiveDateTime!=null">RECEIVE_DATE_TIME=#{et.receiveDateTime},</if>
        <if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
        <if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
        <if test="et.partitionDate!=null">PARTITION_DATE=#{et.partitionDate},</if>
        <if test="et.parentInventoryBo!=null">PARENT_INVENTORY_BO=#{et.parentInventoryBo},</if>
        <if test="et.erpInventory!=null">ERP_INVENTORY=#{et.erpInventory},</if>
    </trim>
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    HANDLE=#{ew.entity.handle}
                    <if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.inventoryId!=null"> AND INVENTORY_ID=#{ew.entity.inventoryId}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.inventoryContextGbo!=null"> AND INVENTORY_CONTEXT_GBO=#{ew.entity.inventoryContextGbo}</if>
                    <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
                    <if test="ew.entity.qtyOnHand!=null"> AND QTY_ON_HAND=#{ew.entity.qtyOnHand}</if>
                    <if test="ew.entity.assyDataTypeBo!=null"> AND ASSY_DATA_TYPE_BO=#{ew.entity.assyDataTypeBo}</if>
                    <if test="ew.entity.usageCount!=null"> AND USAGE_COUNT=#{ew.entity.usageCount}</if>
                    <if test="ew.entity.maximumUsage!=null"> AND MAXIMUM_USAGE=#{ew.entity.maximumUsage}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.originalQty!=null"> AND ORIGINAL_QTY=#{ew.entity.originalQty}</if>
                    <if test="ew.entity.workCenterLocBo!=null"> AND WORK_CENTER_LOC_BO=#{ew.entity.workCenterLocBo}</if>
                    <if test="ew.entity.workCenterLocRes!=null"> AND WORK_CENTER_LOC_RES=#{ew.entity.workCenterLocRes}</if>
                    <if test="ew.entity.operationLocBo!=null"> AND OPERATION_LOC_BO=#{ew.entity.operationLocBo}</if>
                    <if test="ew.entity.operationLocRes!=null"> AND OPERATION_LOC_RES=#{ew.entity.operationLocRes}</if>
                    <if test="ew.entity.resourceLocBo!=null"> AND RESOURCE_LOC_BO=#{ew.entity.resourceLocBo}</if>
                    <if test="ew.entity.resourceLocRes!=null"> AND RESOURCE_LOC_RES=#{ew.entity.resourceLocRes}</if>
                    <if test="ew.entity.shopOrderLocBo!=null"> AND SHOP_ORDER_LOC_BO=#{ew.entity.shopOrderLocBo}</if>
                    <if test="ew.entity.shopOrderLocRes!=null"> AND SHOP_ORDER_LOC_RES=#{ew.entity.shopOrderLocRes}</if>
                    <if test="ew.entity.shopOrderSetByErp!=null"> AND SHOP_ORDER_SET_BY_ERP=#{ew.entity.shopOrderSetByErp}</if>
                    <if test="ew.entity.originalUserBo!=null"> AND ORIGINAL_USER_BO=#{ew.entity.originalUserBo}</if>
                    <if test="ew.entity.storageLocationBo!=null"> AND STORAGE_LOCATION_BO=#{ew.entity.storageLocationBo}</if>
                    <if test="ew.entity.hasBeenUsed!=null"> AND HAS_BEEN_USED=#{ew.entity.hasBeenUsed}</if>
                    <if test="ew.entity.receiveDateTime!=null"> AND RECEIVE_DATE_TIME=#{ew.entity.receiveDateTime}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
                    <if test="ew.entity.parentInventoryBo!=null"> AND PARENT_INVENTORY_BO=#{ew.entity.parentInventoryBo}</if>
                    <if test="ew.entity.erpInventory!=null"> AND ERP_INVENTORY=#{ew.entity.erpInventory}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            ${ew.sqlSegment}
        </if>
    </update>


    <delete id="deleteByMap">
        DELETE FROM INVENTORY
        <if test="cm!=null and !cm.isEmpty">
            <where>
                <foreach collection="cm.keys" item="k" separator="AND">
                    <if test="cm[k] != null">
                        ${k} = #{cm[${k}]}
                    </if>
                </foreach>
            </where>
        </if>
    </delete>

    <delete id="delete">
        DELETE FROM INVENTORY
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.inventoryId!=null"> AND INVENTORY_ID=#{ew.entity.inventoryId}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.inventoryContextGbo!=null"> AND INVENTORY_CONTEXT_GBO=#{ew.entity.inventoryContextGbo}</if>
                    <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
                    <if test="ew.entity.qtyOnHand!=null"> AND QTY_ON_HAND=#{ew.entity.qtyOnHand}</if>
                    <if test="ew.entity.assyDataTypeBo!=null"> AND ASSY_DATA_TYPE_BO=#{ew.entity.assyDataTypeBo}</if>
                    <if test="ew.entity.usageCount!=null"> AND USAGE_COUNT=#{ew.entity.usageCount}</if>
                    <if test="ew.entity.maximumUsage!=null"> AND MAXIMUM_USAGE=#{ew.entity.maximumUsage}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.originalQty!=null"> AND ORIGINAL_QTY=#{ew.entity.originalQty}</if>
                    <if test="ew.entity.workCenterLocBo!=null"> AND WORK_CENTER_LOC_BO=#{ew.entity.workCenterLocBo}</if>
                    <if test="ew.entity.workCenterLocRes!=null"> AND WORK_CENTER_LOC_RES=#{ew.entity.workCenterLocRes}</if>
                    <if test="ew.entity.operationLocBo!=null"> AND OPERATION_LOC_BO=#{ew.entity.operationLocBo}</if>
                    <if test="ew.entity.operationLocRes!=null"> AND OPERATION_LOC_RES=#{ew.entity.operationLocRes}</if>
                    <if test="ew.entity.resourceLocBo!=null"> AND RESOURCE_LOC_BO=#{ew.entity.resourceLocBo}</if>
                    <if test="ew.entity.resourceLocRes!=null"> AND RESOURCE_LOC_RES=#{ew.entity.resourceLocRes}</if>
                    <if test="ew.entity.shopOrderLocBo!=null"> AND SHOP_ORDER_LOC_BO=#{ew.entity.shopOrderLocBo}</if>
                    <if test="ew.entity.shopOrderLocRes!=null"> AND SHOP_ORDER_LOC_RES=#{ew.entity.shopOrderLocRes}</if>
                    <if test="ew.entity.shopOrderSetByErp!=null"> AND SHOP_ORDER_SET_BY_ERP=#{ew.entity.shopOrderSetByErp}</if>
                    <if test="ew.entity.originalUserBo!=null"> AND ORIGINAL_USER_BO=#{ew.entity.originalUserBo}</if>
                    <if test="ew.entity.storageLocationBo!=null"> AND STORAGE_LOCATION_BO=#{ew.entity.storageLocationBo}</if>
                    <if test="ew.entity.hasBeenUsed!=null"> AND HAS_BEEN_USED=#{ew.entity.hasBeenUsed}</if>
                    <if test="ew.entity.receiveDateTime!=null"> AND RECEIVE_DATE_TIME=#{ew.entity.receiveDateTime}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
                    <if test="ew.entity.parentInventoryBo!=null"> AND PARENT_INVENTORY_BO=#{ew.entity.parentInventoryBo}</if>
                    <if test="ew.entity.erpInventory!=null"> AND ERP_INVENTORY=#{ew.entity.erpInventory}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            ${ew.sqlSegment}
        </if>
    </delete>

    <!-- BaseMapper标准查询/修改/删除 -->

</mapper>
