<?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.ShopOrderMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.foreverwin.mesnac.meapi.model.ShopOrder">
        <result column="HANDLE" property="handle" />
        <result column="CHANGE_STAMP" property="changeStamp" />
        <result column="SITE" property="site" />
        <result column="SHOP_ORDER" property="shopOrder" />
        <result column="STATUS_BO" property="statusBo" />
        <result column="PRIORITY" property="priority" />
        <result column="PLANNED_WORK_CENTER_BO" property="plannedWorkCenterBo" />
        <result column="PLANNED_ITEM_BO" property="plannedItemBo" />
        <result column="PLANNED_BOM_BO" property="plannedBomBo" />
        <result column="PLANNED_ROUTER_BO" property="plannedRouterBo" />
        <result column="ITEM_BO" property="itemBo" />
        <result column="BOM_BO" property="bomBo" />
        <result column="ROUTER_BO" property="routerBo" />
        <result column="QTY_TO_BUILD" property="qtyToBuild" />
        <result column="QTY_ORDERED" property="qtyOrdered" />
        <result column="QTY_RELEASED" property="qtyReleased" />
        <result column="RELEASED_DATE" property="releasedDate" />
        <result column="PLANNED_START_DATE" property="plannedStartDate" />
        <result column="PLANNED_COMP_DATE" property="plannedCompDate" />
        <result column="SCHEDULED_START_DATE" property="scheduledStartDate" />
        <result column="SCHEDULED_COMP_DATE" property="scheduledCompDate" />
        <result column="ACTUAL_START_DATE" property="actualStartDate" />
        <result column="ACTUAL_COMP_DATE" property="actualCompDate" />
        <result column="QTY_DONE" property="qtyDone" />
        <result column="QTY_SCRAPPED" property="qtyScrapped" />
        <result column="CREATED_DATE_TIME" property="createdDateTime" />
        <result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
        <result column="CUSTOMER" property="customer" />
        <result column="CUSTOMER_ORDER" property="customerOrder" />
        <result column="RMA_SFC_DATA_TYPE_BO" property="rmaSfcDataTypeBo" />
        <result column="RMA_SHOP_ORDER_DATA_TYPE_BO" property="rmaShopOrderDataTypeBo" />
        <result column="ORIGINAL_STATUS_BO" property="originalStatusBo" />
        <result column="TRANSFER_SITE" property="transferSite" />
        <result column="TRANSFER_TYPE" property="transferType" />
        <result column="LCC_BO" property="lccBo" />
        <result column="SHOP_ORDER_TYPE_BO" property="shopOrderTypeBo" />
        <result column="HOLD_ID" property="holdId" />
        <result column="END_UNIT_NUMBER" property="endUnitNumber" />
        <result column="REQ_SERIAL_CHANGE" property="reqSerialChange" />
        <result column="COLLECT_PARENT_SERIAL" property="collectParentSerial" />
        <result column="BATCH_NUMBER" property="batchNumber" />
        <result column="ERP_ORDER" property="erpOrder" />
        <result column="ERP_PRODUCTION_VERSION" property="erpProductionVersion" />
        <result column="ERP_UNIT_OF_MEASURE" property="erpUnitOfMeasure" />
        <result column="PARTITION_DATE" property="partitionDate" />
        <result column="INSPECTION_LOT" property="inspectionLot" />
        <result column="INSPECTION_GROUP_SIZE" property="inspectionGroupSize" />
        <result column="ERP_PUTAWAY_STORLOC" property="erpPutawayStorloc" />
        <result column="WAREHOUSE_NUMBER" property="warehouseNumber" />
        <result column="UNDERDELIVERY_TOLERANCE" property="underdeliveryTolerance" />
        <result column="OVERDELIVERY_TOLERANCE" property="overdeliveryTolerance" />
        <result column="UNLIMITED_OVERDELIVERY" property="unlimitedOverdelivery" />
        <result column="MINIMUM_DELIVERY_QTY" property="minimumDeliveryQty" />
        <result column="MAXIMUM_DELIVERY_QTY" property="maximumDeliveryQty" />
        <result column="TOLERANCE_DEFINED_IN" property="toleranceDefinedIn" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        HANDLE, CHANGE_STAMP, SITE, SHOP_ORDER, STATUS_BO, PRIORITY, PLANNED_WORK_CENTER_BO, PLANNED_ITEM_BO, PLANNED_BOM_BO, PLANNED_ROUTER_BO, ITEM_BO, BOM_BO, ROUTER_BO, QTY_TO_BUILD, QTY_ORDERED, QTY_RELEASED, RELEASED_DATE, PLANNED_START_DATE, PLANNED_COMP_DATE, SCHEDULED_START_DATE, SCHEDULED_COMP_DATE, ACTUAL_START_DATE, ACTUAL_COMP_DATE, QTY_DONE, QTY_SCRAPPED, CREATED_DATE_TIME, MODIFIED_DATE_TIME, CUSTOMER, CUSTOMER_ORDER, RMA_SFC_DATA_TYPE_BO, RMA_SHOP_ORDER_DATA_TYPE_BO, ORIGINAL_STATUS_BO, TRANSFER_SITE, TRANSFER_TYPE, LCC_BO, SHOP_ORDER_TYPE_BO, HOLD_ID, END_UNIT_NUMBER, REQ_SERIAL_CHANGE, COLLECT_PARENT_SERIAL, BATCH_NUMBER, ERP_ORDER, ERP_PRODUCTION_VERSION, ERP_UNIT_OF_MEASURE, PARTITION_DATE, INSPECTION_LOT, INSPECTION_GROUP_SIZE, ERP_PUTAWAY_STORLOC, WAREHOUSE_NUMBER, UNDERDELIVERY_TOLERANCE, OVERDELIVERY_TOLERANCE, UNLIMITED_OVERDELIVERY, MINIMUM_DELIVERY_QTY, MAXIMUM_DELIVERY_QTY, TOLERANCE_DEFINED_IN
    </sql>

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

    <select id="selectByMap" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include>
        FROM SHOP_ORDER
        <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 SHOP_ORDER
        <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.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
            <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
            <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
            <if test="ew.entity.plannedWorkCenterBo!=null"> AND PLANNED_WORK_CENTER_BO=#{ew.entity.plannedWorkCenterBo}</if>
            <if test="ew.entity.plannedItemBo!=null"> AND PLANNED_ITEM_BO=#{ew.entity.plannedItemBo}</if>
            <if test="ew.entity.plannedBomBo!=null"> AND PLANNED_BOM_BO=#{ew.entity.plannedBomBo}</if>
            <if test="ew.entity.plannedRouterBo!=null"> AND PLANNED_ROUTER_BO=#{ew.entity.plannedRouterBo}</if>
            <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
            <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
            <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
            <if test="ew.entity.qtyToBuild!=null"> AND QTY_TO_BUILD=#{ew.entity.qtyToBuild}</if>
            <if test="ew.entity.qtyOrdered!=null"> AND QTY_ORDERED=#{ew.entity.qtyOrdered}</if>
            <if test="ew.entity.qtyReleased!=null"> AND QTY_RELEASED=#{ew.entity.qtyReleased}</if>
            <if test="ew.entity.releasedDate!=null"> AND RELEASED_DATE=#{ew.entity.releasedDate}</if>
            <if test="ew.entity.plannedStartDate!=null"> AND PLANNED_START_DATE=#{ew.entity.plannedStartDate}</if>
            <if test="ew.entity.plannedCompDate!=null"> AND PLANNED_COMP_DATE=#{ew.entity.plannedCompDate}</if>
            <if test="ew.entity.scheduledStartDate!=null"> AND SCHEDULED_START_DATE=#{ew.entity.scheduledStartDate}</if>
            <if test="ew.entity.scheduledCompDate!=null"> AND SCHEDULED_COMP_DATE=#{ew.entity.scheduledCompDate}</if>
            <if test="ew.entity.actualStartDate!=null"> AND ACTUAL_START_DATE=#{ew.entity.actualStartDate}</if>
            <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
            <if test="ew.entity.qtyDone!=null"> AND QTY_DONE=#{ew.entity.qtyDone}</if>
            <if test="ew.entity.qtyScrapped!=null"> AND QTY_SCRAPPED=#{ew.entity.qtyScrapped}</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.customer!=null"> AND CUSTOMER=#{ew.entity.customer}</if>
            <if test="ew.entity.customerOrder!=null"> AND CUSTOMER_ORDER=#{ew.entity.customerOrder}</if>
            <if test="ew.entity.rmaSfcDataTypeBo!=null"> AND RMA_SFC_DATA_TYPE_BO=#{ew.entity.rmaSfcDataTypeBo}</if>
            <if test="ew.entity.rmaShopOrderDataTypeBo!=null"> AND RMA_SHOP_ORDER_DATA_TYPE_BO=#{ew.entity.rmaShopOrderDataTypeBo}</if>
            <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
            <if test="ew.entity.transferSite!=null"> AND TRANSFER_SITE=#{ew.entity.transferSite}</if>
            <if test="ew.entity.transferType!=null"> AND TRANSFER_TYPE=#{ew.entity.transferType}</if>
            <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
            <if test="ew.entity.shopOrderTypeBo!=null"> AND SHOP_ORDER_TYPE_BO=#{ew.entity.shopOrderTypeBo}</if>
            <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
            <if test="ew.entity.endUnitNumber!=null"> AND END_UNIT_NUMBER=#{ew.entity.endUnitNumber}</if>
            <if test="ew.entity.reqSerialChange!=null"> AND REQ_SERIAL_CHANGE=#{ew.entity.reqSerialChange}</if>
            <if test="ew.entity.collectParentSerial!=null"> AND COLLECT_PARENT_SERIAL=#{ew.entity.collectParentSerial}</if>
            <if test="ew.entity.batchNumber!=null"> AND BATCH_NUMBER=#{ew.entity.batchNumber}</if>
            <if test="ew.entity.erpOrder!=null"> AND ERP_ORDER=#{ew.entity.erpOrder}</if>
            <if test="ew.entity.erpProductionVersion!=null"> AND ERP_PRODUCTION_VERSION=#{ew.entity.erpProductionVersion}</if>
            <if test="ew.entity.erpUnitOfMeasure!=null"> AND ERP_UNIT_OF_MEASURE=#{ew.entity.erpUnitOfMeasure}</if>
            <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
            <if test="ew.entity.inspectionLot!=null"> AND INSPECTION_LOT=#{ew.entity.inspectionLot}</if>
            <if test="ew.entity.inspectionGroupSize!=null"> AND INSPECTION_GROUP_SIZE=#{ew.entity.inspectionGroupSize}</if>
            <if test="ew.entity.erpPutawayStorloc!=null"> AND ERP_PUTAWAY_STORLOC=#{ew.entity.erpPutawayStorloc}</if>
            <if test="ew.entity.warehouseNumber!=null"> AND WAREHOUSE_NUMBER=#{ew.entity.warehouseNumber}</if>
            <if test="ew.entity.underdeliveryTolerance!=null"> AND UNDERDELIVERY_TOLERANCE=#{ew.entity.underdeliveryTolerance}</if>
            <if test="ew.entity.overdeliveryTolerance!=null"> AND OVERDELIVERY_TOLERANCE=#{ew.entity.overdeliveryTolerance}</if>
            <if test="ew.entity.unlimitedOverdelivery!=null"> AND UNLIMITED_OVERDELIVERY=#{ew.entity.unlimitedOverdelivery}</if>
            <if test="ew.entity.minimumDeliveryQty!=null"> AND MINIMUM_DELIVERY_QTY=#{ew.entity.minimumDeliveryQty}</if>
            <if test="ew.entity.maximumDeliveryQty!=null"> AND MAXIMUM_DELIVERY_QTY=#{ew.entity.maximumDeliveryQty}</if>
            <if test="ew.entity.toleranceDefinedIn!=null"> AND TOLERANCE_DEFINED_IN=#{ew.entity.toleranceDefinedIn}</if>
        </where>
    </select>

    <select id="selectCount" resultType="Integer">
        SELECT COUNT(1) FROM SHOP_ORDER
        <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.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
                <if test="ew.entity.plannedWorkCenterBo!=null"> AND PLANNED_WORK_CENTER_BO=#{ew.entity.plannedWorkCenterBo}</if>
                <if test="ew.entity.plannedItemBo!=null"> AND PLANNED_ITEM_BO=#{ew.entity.plannedItemBo}</if>
                <if test="ew.entity.plannedBomBo!=null"> AND PLANNED_BOM_BO=#{ew.entity.plannedBomBo}</if>
                <if test="ew.entity.plannedRouterBo!=null"> AND PLANNED_ROUTER_BO=#{ew.entity.plannedRouterBo}</if>
                <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
                <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
                <if test="ew.entity.qtyToBuild!=null"> AND QTY_TO_BUILD=#{ew.entity.qtyToBuild}</if>
                <if test="ew.entity.qtyOrdered!=null"> AND QTY_ORDERED=#{ew.entity.qtyOrdered}</if>
                <if test="ew.entity.qtyReleased!=null"> AND QTY_RELEASED=#{ew.entity.qtyReleased}</if>
                <if test="ew.entity.releasedDate!=null"> AND RELEASED_DATE=#{ew.entity.releasedDate}</if>
                <if test="ew.entity.plannedStartDate!=null"> AND PLANNED_START_DATE=#{ew.entity.plannedStartDate}</if>
                <if test="ew.entity.plannedCompDate!=null"> AND PLANNED_COMP_DATE=#{ew.entity.plannedCompDate}</if>
                <if test="ew.entity.scheduledStartDate!=null"> AND SCHEDULED_START_DATE=#{ew.entity.scheduledStartDate}</if>
                <if test="ew.entity.scheduledCompDate!=null"> AND SCHEDULED_COMP_DATE=#{ew.entity.scheduledCompDate}</if>
                <if test="ew.entity.actualStartDate!=null"> AND ACTUAL_START_DATE=#{ew.entity.actualStartDate}</if>
                <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
                <if test="ew.entity.qtyDone!=null"> AND QTY_DONE=#{ew.entity.qtyDone}</if>
                <if test="ew.entity.qtyScrapped!=null"> AND QTY_SCRAPPED=#{ew.entity.qtyScrapped}</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.customer!=null"> AND CUSTOMER=#{ew.entity.customer}</if>
                <if test="ew.entity.customerOrder!=null"> AND CUSTOMER_ORDER=#{ew.entity.customerOrder}</if>
                <if test="ew.entity.rmaSfcDataTypeBo!=null"> AND RMA_SFC_DATA_TYPE_BO=#{ew.entity.rmaSfcDataTypeBo}</if>
                <if test="ew.entity.rmaShopOrderDataTypeBo!=null"> AND RMA_SHOP_ORDER_DATA_TYPE_BO=#{ew.entity.rmaShopOrderDataTypeBo}</if>
                <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                <if test="ew.entity.transferSite!=null"> AND TRANSFER_SITE=#{ew.entity.transferSite}</if>
                <if test="ew.entity.transferType!=null"> AND TRANSFER_TYPE=#{ew.entity.transferType}</if>
                <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
                <if test="ew.entity.shopOrderTypeBo!=null"> AND SHOP_ORDER_TYPE_BO=#{ew.entity.shopOrderTypeBo}</if>
                <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
                <if test="ew.entity.endUnitNumber!=null"> AND END_UNIT_NUMBER=#{ew.entity.endUnitNumber}</if>
                <if test="ew.entity.reqSerialChange!=null"> AND REQ_SERIAL_CHANGE=#{ew.entity.reqSerialChange}</if>
                <if test="ew.entity.collectParentSerial!=null"> AND COLLECT_PARENT_SERIAL=#{ew.entity.collectParentSerial}</if>
                <if test="ew.entity.batchNumber!=null"> AND BATCH_NUMBER=#{ew.entity.batchNumber}</if>
                <if test="ew.entity.erpOrder!=null"> AND ERP_ORDER=#{ew.entity.erpOrder}</if>
                <if test="ew.entity.erpProductionVersion!=null"> AND ERP_PRODUCTION_VERSION=#{ew.entity.erpProductionVersion}</if>
                <if test="ew.entity.erpUnitOfMeasure!=null"> AND ERP_UNIT_OF_MEASURE=#{ew.entity.erpUnitOfMeasure}</if>
                <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
                <if test="ew.entity.inspectionLot!=null"> AND INSPECTION_LOT=#{ew.entity.inspectionLot}</if>
                <if test="ew.entity.inspectionGroupSize!=null"> AND INSPECTION_GROUP_SIZE=#{ew.entity.inspectionGroupSize}</if>
                <if test="ew.entity.erpPutawayStorloc!=null"> AND ERP_PUTAWAY_STORLOC=#{ew.entity.erpPutawayStorloc}</if>
                <if test="ew.entity.warehouseNumber!=null"> AND WAREHOUSE_NUMBER=#{ew.entity.warehouseNumber}</if>
                <if test="ew.entity.underdeliveryTolerance!=null"> AND UNDERDELIVERY_TOLERANCE=#{ew.entity.underdeliveryTolerance}</if>
                <if test="ew.entity.overdeliveryTolerance!=null"> AND OVERDELIVERY_TOLERANCE=#{ew.entity.overdeliveryTolerance}</if>
                <if test="ew.entity.unlimitedOverdelivery!=null"> AND UNLIMITED_OVERDELIVERY=#{ew.entity.unlimitedOverdelivery}</if>
                <if test="ew.entity.minimumDeliveryQty!=null"> AND MINIMUM_DELIVERY_QTY=#{ew.entity.minimumDeliveryQty}</if>
                <if test="ew.entity.maximumDeliveryQty!=null"> AND MAXIMUM_DELIVERY_QTY=#{ew.entity.maximumDeliveryQty}</if>
                <if test="ew.entity.toleranceDefinedIn!=null"> AND TOLERANCE_DEFINED_IN=#{ew.entity.toleranceDefinedIn}</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 SHOP_ORDER
        <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.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
                    <if test="ew.entity.plannedWorkCenterBo!=null"> AND PLANNED_WORK_CENTER_BO=#{ew.entity.plannedWorkCenterBo}</if>
                    <if test="ew.entity.plannedItemBo!=null"> AND PLANNED_ITEM_BO=#{ew.entity.plannedItemBo}</if>
                    <if test="ew.entity.plannedBomBo!=null"> AND PLANNED_BOM_BO=#{ew.entity.plannedBomBo}</if>
                    <if test="ew.entity.plannedRouterBo!=null"> AND PLANNED_ROUTER_BO=#{ew.entity.plannedRouterBo}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
                    <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
                    <if test="ew.entity.qtyToBuild!=null"> AND QTY_TO_BUILD=#{ew.entity.qtyToBuild}</if>
                    <if test="ew.entity.qtyOrdered!=null"> AND QTY_ORDERED=#{ew.entity.qtyOrdered}</if>
                    <if test="ew.entity.qtyReleased!=null"> AND QTY_RELEASED=#{ew.entity.qtyReleased}</if>
                    <if test="ew.entity.releasedDate!=null"> AND RELEASED_DATE=#{ew.entity.releasedDate}</if>
                    <if test="ew.entity.plannedStartDate!=null"> AND PLANNED_START_DATE=#{ew.entity.plannedStartDate}</if>
                    <if test="ew.entity.plannedCompDate!=null"> AND PLANNED_COMP_DATE=#{ew.entity.plannedCompDate}</if>
                    <if test="ew.entity.scheduledStartDate!=null"> AND SCHEDULED_START_DATE=#{ew.entity.scheduledStartDate}</if>
                    <if test="ew.entity.scheduledCompDate!=null"> AND SCHEDULED_COMP_DATE=#{ew.entity.scheduledCompDate}</if>
                    <if test="ew.entity.actualStartDate!=null"> AND ACTUAL_START_DATE=#{ew.entity.actualStartDate}</if>
                    <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
                    <if test="ew.entity.qtyDone!=null"> AND QTY_DONE=#{ew.entity.qtyDone}</if>
                    <if test="ew.entity.qtyScrapped!=null"> AND QTY_SCRAPPED=#{ew.entity.qtyScrapped}</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.customer!=null"> AND CUSTOMER=#{ew.entity.customer}</if>
                    <if test="ew.entity.customerOrder!=null"> AND CUSTOMER_ORDER=#{ew.entity.customerOrder}</if>
                    <if test="ew.entity.rmaSfcDataTypeBo!=null"> AND RMA_SFC_DATA_TYPE_BO=#{ew.entity.rmaSfcDataTypeBo}</if>
                    <if test="ew.entity.rmaShopOrderDataTypeBo!=null"> AND RMA_SHOP_ORDER_DATA_TYPE_BO=#{ew.entity.rmaShopOrderDataTypeBo}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.transferSite!=null"> AND TRANSFER_SITE=#{ew.entity.transferSite}</if>
                    <if test="ew.entity.transferType!=null"> AND TRANSFER_TYPE=#{ew.entity.transferType}</if>
                    <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
                    <if test="ew.entity.shopOrderTypeBo!=null"> AND SHOP_ORDER_TYPE_BO=#{ew.entity.shopOrderTypeBo}</if>
                    <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
                    <if test="ew.entity.endUnitNumber!=null"> AND END_UNIT_NUMBER=#{ew.entity.endUnitNumber}</if>
                    <if test="ew.entity.reqSerialChange!=null"> AND REQ_SERIAL_CHANGE=#{ew.entity.reqSerialChange}</if>
                    <if test="ew.entity.collectParentSerial!=null"> AND COLLECT_PARENT_SERIAL=#{ew.entity.collectParentSerial}</if>
                    <if test="ew.entity.batchNumber!=null"> AND BATCH_NUMBER=#{ew.entity.batchNumber}</if>
                    <if test="ew.entity.erpOrder!=null"> AND ERP_ORDER=#{ew.entity.erpOrder}</if>
                    <if test="ew.entity.erpProductionVersion!=null"> AND ERP_PRODUCTION_VERSION=#{ew.entity.erpProductionVersion}</if>
                    <if test="ew.entity.erpUnitOfMeasure!=null"> AND ERP_UNIT_OF_MEASURE=#{ew.entity.erpUnitOfMeasure}</if>
                    <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
                    <if test="ew.entity.inspectionLot!=null"> AND INSPECTION_LOT=#{ew.entity.inspectionLot}</if>
                    <if test="ew.entity.inspectionGroupSize!=null"> AND INSPECTION_GROUP_SIZE=#{ew.entity.inspectionGroupSize}</if>
                    <if test="ew.entity.erpPutawayStorloc!=null"> AND ERP_PUTAWAY_STORLOC=#{ew.entity.erpPutawayStorloc}</if>
                    <if test="ew.entity.warehouseNumber!=null"> AND WAREHOUSE_NUMBER=#{ew.entity.warehouseNumber}</if>
                    <if test="ew.entity.underdeliveryTolerance!=null"> AND UNDERDELIVERY_TOLERANCE=#{ew.entity.underdeliveryTolerance}</if>
                    <if test="ew.entity.overdeliveryTolerance!=null"> AND OVERDELIVERY_TOLERANCE=#{ew.entity.overdeliveryTolerance}</if>
                    <if test="ew.entity.unlimitedOverdelivery!=null"> AND UNLIMITED_OVERDELIVERY=#{ew.entity.unlimitedOverdelivery}</if>
                    <if test="ew.entity.minimumDeliveryQty!=null"> AND MINIMUM_DELIVERY_QTY=#{ew.entity.minimumDeliveryQty}</if>
                    <if test="ew.entity.maximumDeliveryQty!=null"> AND MAXIMUM_DELIVERY_QTY=#{ew.entity.maximumDeliveryQty}</if>
                    <if test="ew.entity.toleranceDefinedIn!=null"> AND TOLERANCE_DEFINED_IN=#{ew.entity.toleranceDefinedIn}</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 SHOP_ORDER
        <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.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
                    <if test="ew.entity.plannedWorkCenterBo!=null"> AND PLANNED_WORK_CENTER_BO=#{ew.entity.plannedWorkCenterBo}</if>
                    <if test="ew.entity.plannedItemBo!=null"> AND PLANNED_ITEM_BO=#{ew.entity.plannedItemBo}</if>
                    <if test="ew.entity.plannedBomBo!=null"> AND PLANNED_BOM_BO=#{ew.entity.plannedBomBo}</if>
                    <if test="ew.entity.plannedRouterBo!=null"> AND PLANNED_ROUTER_BO=#{ew.entity.plannedRouterBo}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
                    <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
                    <if test="ew.entity.qtyToBuild!=null"> AND QTY_TO_BUILD=#{ew.entity.qtyToBuild}</if>
                    <if test="ew.entity.qtyOrdered!=null"> AND QTY_ORDERED=#{ew.entity.qtyOrdered}</if>
                    <if test="ew.entity.qtyReleased!=null"> AND QTY_RELEASED=#{ew.entity.qtyReleased}</if>
                    <if test="ew.entity.releasedDate!=null"> AND RELEASED_DATE=#{ew.entity.releasedDate}</if>
                    <if test="ew.entity.plannedStartDate!=null"> AND PLANNED_START_DATE=#{ew.entity.plannedStartDate}</if>
                    <if test="ew.entity.plannedCompDate!=null"> AND PLANNED_COMP_DATE=#{ew.entity.plannedCompDate}</if>
                    <if test="ew.entity.scheduledStartDate!=null"> AND SCHEDULED_START_DATE=#{ew.entity.scheduledStartDate}</if>
                    <if test="ew.entity.scheduledCompDate!=null"> AND SCHEDULED_COMP_DATE=#{ew.entity.scheduledCompDate}</if>
                    <if test="ew.entity.actualStartDate!=null"> AND ACTUAL_START_DATE=#{ew.entity.actualStartDate}</if>
                    <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
                    <if test="ew.entity.qtyDone!=null"> AND QTY_DONE=#{ew.entity.qtyDone}</if>
                    <if test="ew.entity.qtyScrapped!=null"> AND QTY_SCRAPPED=#{ew.entity.qtyScrapped}</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.customer!=null"> AND CUSTOMER=#{ew.entity.customer}</if>
                    <if test="ew.entity.customerOrder!=null"> AND CUSTOMER_ORDER=#{ew.entity.customerOrder}</if>
                    <if test="ew.entity.rmaSfcDataTypeBo!=null"> AND RMA_SFC_DATA_TYPE_BO=#{ew.entity.rmaSfcDataTypeBo}</if>
                    <if test="ew.entity.rmaShopOrderDataTypeBo!=null"> AND RMA_SHOP_ORDER_DATA_TYPE_BO=#{ew.entity.rmaShopOrderDataTypeBo}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.transferSite!=null"> AND TRANSFER_SITE=#{ew.entity.transferSite}</if>
                    <if test="ew.entity.transferType!=null"> AND TRANSFER_TYPE=#{ew.entity.transferType}</if>
                    <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
                    <if test="ew.entity.shopOrderTypeBo!=null"> AND SHOP_ORDER_TYPE_BO=#{ew.entity.shopOrderTypeBo}</if>
                    <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
                    <if test="ew.entity.endUnitNumber!=null"> AND END_UNIT_NUMBER=#{ew.entity.endUnitNumber}</if>
                    <if test="ew.entity.reqSerialChange!=null"> AND REQ_SERIAL_CHANGE=#{ew.entity.reqSerialChange}</if>
                    <if test="ew.entity.collectParentSerial!=null"> AND COLLECT_PARENT_SERIAL=#{ew.entity.collectParentSerial}</if>
                    <if test="ew.entity.batchNumber!=null"> AND BATCH_NUMBER=#{ew.entity.batchNumber}</if>
                    <if test="ew.entity.erpOrder!=null"> AND ERP_ORDER=#{ew.entity.erpOrder}</if>
                    <if test="ew.entity.erpProductionVersion!=null"> AND ERP_PRODUCTION_VERSION=#{ew.entity.erpProductionVersion}</if>
                    <if test="ew.entity.erpUnitOfMeasure!=null"> AND ERP_UNIT_OF_MEASURE=#{ew.entity.erpUnitOfMeasure}</if>
                    <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
                    <if test="ew.entity.inspectionLot!=null"> AND INSPECTION_LOT=#{ew.entity.inspectionLot}</if>
                    <if test="ew.entity.inspectionGroupSize!=null"> AND INSPECTION_GROUP_SIZE=#{ew.entity.inspectionGroupSize}</if>
                    <if test="ew.entity.erpPutawayStorloc!=null"> AND ERP_PUTAWAY_STORLOC=#{ew.entity.erpPutawayStorloc}</if>
                    <if test="ew.entity.warehouseNumber!=null"> AND WAREHOUSE_NUMBER=#{ew.entity.warehouseNumber}</if>
                    <if test="ew.entity.underdeliveryTolerance!=null"> AND UNDERDELIVERY_TOLERANCE=#{ew.entity.underdeliveryTolerance}</if>
                    <if test="ew.entity.overdeliveryTolerance!=null"> AND OVERDELIVERY_TOLERANCE=#{ew.entity.overdeliveryTolerance}</if>
                    <if test="ew.entity.unlimitedOverdelivery!=null"> AND UNLIMITED_OVERDELIVERY=#{ew.entity.unlimitedOverdelivery}</if>
                    <if test="ew.entity.minimumDeliveryQty!=null"> AND MINIMUM_DELIVERY_QTY=#{ew.entity.minimumDeliveryQty}</if>
                    <if test="ew.entity.maximumDeliveryQty!=null"> AND MAXIMUM_DELIVERY_QTY=#{ew.entity.maximumDeliveryQty}</if>
                    <if test="ew.entity.toleranceDefinedIn!=null"> AND TOLERANCE_DEFINED_IN=#{ew.entity.toleranceDefinedIn}</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 SHOP_ORDER
        <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.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
                    <if test="ew.entity.plannedWorkCenterBo!=null"> AND PLANNED_WORK_CENTER_BO=#{ew.entity.plannedWorkCenterBo}</if>
                    <if test="ew.entity.plannedItemBo!=null"> AND PLANNED_ITEM_BO=#{ew.entity.plannedItemBo}</if>
                    <if test="ew.entity.plannedBomBo!=null"> AND PLANNED_BOM_BO=#{ew.entity.plannedBomBo}</if>
                    <if test="ew.entity.plannedRouterBo!=null"> AND PLANNED_ROUTER_BO=#{ew.entity.plannedRouterBo}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
                    <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
                    <if test="ew.entity.qtyToBuild!=null"> AND QTY_TO_BUILD=#{ew.entity.qtyToBuild}</if>
                    <if test="ew.entity.qtyOrdered!=null"> AND QTY_ORDERED=#{ew.entity.qtyOrdered}</if>
                    <if test="ew.entity.qtyReleased!=null"> AND QTY_RELEASED=#{ew.entity.qtyReleased}</if>
                    <if test="ew.entity.releasedDate!=null"> AND RELEASED_DATE=#{ew.entity.releasedDate}</if>
                    <if test="ew.entity.plannedStartDate!=null"> AND PLANNED_START_DATE=#{ew.entity.plannedStartDate}</if>
                    <if test="ew.entity.plannedCompDate!=null"> AND PLANNED_COMP_DATE=#{ew.entity.plannedCompDate}</if>
                    <if test="ew.entity.scheduledStartDate!=null"> AND SCHEDULED_START_DATE=#{ew.entity.scheduledStartDate}</if>
                    <if test="ew.entity.scheduledCompDate!=null"> AND SCHEDULED_COMP_DATE=#{ew.entity.scheduledCompDate}</if>
                    <if test="ew.entity.actualStartDate!=null"> AND ACTUAL_START_DATE=#{ew.entity.actualStartDate}</if>
                    <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
                    <if test="ew.entity.qtyDone!=null"> AND QTY_DONE=#{ew.entity.qtyDone}</if>
                    <if test="ew.entity.qtyScrapped!=null"> AND QTY_SCRAPPED=#{ew.entity.qtyScrapped}</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.customer!=null"> AND CUSTOMER=#{ew.entity.customer}</if>
                    <if test="ew.entity.customerOrder!=null"> AND CUSTOMER_ORDER=#{ew.entity.customerOrder}</if>
                    <if test="ew.entity.rmaSfcDataTypeBo!=null"> AND RMA_SFC_DATA_TYPE_BO=#{ew.entity.rmaSfcDataTypeBo}</if>
                    <if test="ew.entity.rmaShopOrderDataTypeBo!=null"> AND RMA_SHOP_ORDER_DATA_TYPE_BO=#{ew.entity.rmaShopOrderDataTypeBo}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.transferSite!=null"> AND TRANSFER_SITE=#{ew.entity.transferSite}</if>
                    <if test="ew.entity.transferType!=null"> AND TRANSFER_TYPE=#{ew.entity.transferType}</if>
                    <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
                    <if test="ew.entity.shopOrderTypeBo!=null"> AND SHOP_ORDER_TYPE_BO=#{ew.entity.shopOrderTypeBo}</if>
                    <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
                    <if test="ew.entity.endUnitNumber!=null"> AND END_UNIT_NUMBER=#{ew.entity.endUnitNumber}</if>
                    <if test="ew.entity.reqSerialChange!=null"> AND REQ_SERIAL_CHANGE=#{ew.entity.reqSerialChange}</if>
                    <if test="ew.entity.collectParentSerial!=null"> AND COLLECT_PARENT_SERIAL=#{ew.entity.collectParentSerial}</if>
                    <if test="ew.entity.batchNumber!=null"> AND BATCH_NUMBER=#{ew.entity.batchNumber}</if>
                    <if test="ew.entity.erpOrder!=null"> AND ERP_ORDER=#{ew.entity.erpOrder}</if>
                    <if test="ew.entity.erpProductionVersion!=null"> AND ERP_PRODUCTION_VERSION=#{ew.entity.erpProductionVersion}</if>
                    <if test="ew.entity.erpUnitOfMeasure!=null"> AND ERP_UNIT_OF_MEASURE=#{ew.entity.erpUnitOfMeasure}</if>
                    <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
                    <if test="ew.entity.inspectionLot!=null"> AND INSPECTION_LOT=#{ew.entity.inspectionLot}</if>
                    <if test="ew.entity.inspectionGroupSize!=null"> AND INSPECTION_GROUP_SIZE=#{ew.entity.inspectionGroupSize}</if>
                    <if test="ew.entity.erpPutawayStorloc!=null"> AND ERP_PUTAWAY_STORLOC=#{ew.entity.erpPutawayStorloc}</if>
                    <if test="ew.entity.warehouseNumber!=null"> AND WAREHOUSE_NUMBER=#{ew.entity.warehouseNumber}</if>
                    <if test="ew.entity.underdeliveryTolerance!=null"> AND UNDERDELIVERY_TOLERANCE=#{ew.entity.underdeliveryTolerance}</if>
                    <if test="ew.entity.overdeliveryTolerance!=null"> AND OVERDELIVERY_TOLERANCE=#{ew.entity.overdeliveryTolerance}</if>
                    <if test="ew.entity.unlimitedOverdelivery!=null"> AND UNLIMITED_OVERDELIVERY=#{ew.entity.unlimitedOverdelivery}</if>
                    <if test="ew.entity.minimumDeliveryQty!=null"> AND MINIMUM_DELIVERY_QTY=#{ew.entity.minimumDeliveryQty}</if>
                    <if test="ew.entity.maximumDeliveryQty!=null"> AND MAXIMUM_DELIVERY_QTY=#{ew.entity.maximumDeliveryQty}</if>
                    <if test="ew.entity.toleranceDefinedIn!=null"> AND TOLERANCE_DEFINED_IN=#{ew.entity.toleranceDefinedIn}</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 SHOP_ORDER
        <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.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
                    <if test="ew.entity.plannedWorkCenterBo!=null"> AND PLANNED_WORK_CENTER_BO=#{ew.entity.plannedWorkCenterBo}</if>
                    <if test="ew.entity.plannedItemBo!=null"> AND PLANNED_ITEM_BO=#{ew.entity.plannedItemBo}</if>
                    <if test="ew.entity.plannedBomBo!=null"> AND PLANNED_BOM_BO=#{ew.entity.plannedBomBo}</if>
                    <if test="ew.entity.plannedRouterBo!=null"> AND PLANNED_ROUTER_BO=#{ew.entity.plannedRouterBo}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
                    <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
                    <if test="ew.entity.qtyToBuild!=null"> AND QTY_TO_BUILD=#{ew.entity.qtyToBuild}</if>
                    <if test="ew.entity.qtyOrdered!=null"> AND QTY_ORDERED=#{ew.entity.qtyOrdered}</if>
                    <if test="ew.entity.qtyReleased!=null"> AND QTY_RELEASED=#{ew.entity.qtyReleased}</if>
                    <if test="ew.entity.releasedDate!=null"> AND RELEASED_DATE=#{ew.entity.releasedDate}</if>
                    <if test="ew.entity.plannedStartDate!=null"> AND PLANNED_START_DATE=#{ew.entity.plannedStartDate}</if>
                    <if test="ew.entity.plannedCompDate!=null"> AND PLANNED_COMP_DATE=#{ew.entity.plannedCompDate}</if>
                    <if test="ew.entity.scheduledStartDate!=null"> AND SCHEDULED_START_DATE=#{ew.entity.scheduledStartDate}</if>
                    <if test="ew.entity.scheduledCompDate!=null"> AND SCHEDULED_COMP_DATE=#{ew.entity.scheduledCompDate}</if>
                    <if test="ew.entity.actualStartDate!=null"> AND ACTUAL_START_DATE=#{ew.entity.actualStartDate}</if>
                    <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
                    <if test="ew.entity.qtyDone!=null"> AND QTY_DONE=#{ew.entity.qtyDone}</if>
                    <if test="ew.entity.qtyScrapped!=null"> AND QTY_SCRAPPED=#{ew.entity.qtyScrapped}</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.customer!=null"> AND CUSTOMER=#{ew.entity.customer}</if>
                    <if test="ew.entity.customerOrder!=null"> AND CUSTOMER_ORDER=#{ew.entity.customerOrder}</if>
                    <if test="ew.entity.rmaSfcDataTypeBo!=null"> AND RMA_SFC_DATA_TYPE_BO=#{ew.entity.rmaSfcDataTypeBo}</if>
                    <if test="ew.entity.rmaShopOrderDataTypeBo!=null"> AND RMA_SHOP_ORDER_DATA_TYPE_BO=#{ew.entity.rmaShopOrderDataTypeBo}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.transferSite!=null"> AND TRANSFER_SITE=#{ew.entity.transferSite}</if>
                    <if test="ew.entity.transferType!=null"> AND TRANSFER_TYPE=#{ew.entity.transferType}</if>
                    <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
                    <if test="ew.entity.shopOrderTypeBo!=null"> AND SHOP_ORDER_TYPE_BO=#{ew.entity.shopOrderTypeBo}</if>
                    <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
                    <if test="ew.entity.endUnitNumber!=null"> AND END_UNIT_NUMBER=#{ew.entity.endUnitNumber}</if>
                    <if test="ew.entity.reqSerialChange!=null"> AND REQ_SERIAL_CHANGE=#{ew.entity.reqSerialChange}</if>
                    <if test="ew.entity.collectParentSerial!=null"> AND COLLECT_PARENT_SERIAL=#{ew.entity.collectParentSerial}</if>
                    <if test="ew.entity.batchNumber!=null"> AND BATCH_NUMBER=#{ew.entity.batchNumber}</if>
                    <if test="ew.entity.erpOrder!=null"> AND ERP_ORDER=#{ew.entity.erpOrder}</if>
                    <if test="ew.entity.erpProductionVersion!=null"> AND ERP_PRODUCTION_VERSION=#{ew.entity.erpProductionVersion}</if>
                    <if test="ew.entity.erpUnitOfMeasure!=null"> AND ERP_UNIT_OF_MEASURE=#{ew.entity.erpUnitOfMeasure}</if>
                    <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
                    <if test="ew.entity.inspectionLot!=null"> AND INSPECTION_LOT=#{ew.entity.inspectionLot}</if>
                    <if test="ew.entity.inspectionGroupSize!=null"> AND INSPECTION_GROUP_SIZE=#{ew.entity.inspectionGroupSize}</if>
                    <if test="ew.entity.erpPutawayStorloc!=null"> AND ERP_PUTAWAY_STORLOC=#{ew.entity.erpPutawayStorloc}</if>
                    <if test="ew.entity.warehouseNumber!=null"> AND WAREHOUSE_NUMBER=#{ew.entity.warehouseNumber}</if>
                    <if test="ew.entity.underdeliveryTolerance!=null"> AND UNDERDELIVERY_TOLERANCE=#{ew.entity.underdeliveryTolerance}</if>
                    <if test="ew.entity.overdeliveryTolerance!=null"> AND OVERDELIVERY_TOLERANCE=#{ew.entity.overdeliveryTolerance}</if>
                    <if test="ew.entity.unlimitedOverdelivery!=null"> AND UNLIMITED_OVERDELIVERY=#{ew.entity.unlimitedOverdelivery}</if>
                    <if test="ew.entity.minimumDeliveryQty!=null"> AND MINIMUM_DELIVERY_QTY=#{ew.entity.minimumDeliveryQty}</if>
                    <if test="ew.entity.maximumDeliveryQty!=null"> AND MAXIMUM_DELIVERY_QTY=#{ew.entity.maximumDeliveryQty}</if>
                    <if test="ew.entity.toleranceDefinedIn!=null"> AND TOLERANCE_DEFINED_IN=#{ew.entity.toleranceDefinedIn}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    AND ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            AND ${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 SHOP_ORDER
        <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.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
                    <if test="ew.entity.plannedWorkCenterBo!=null"> AND PLANNED_WORK_CENTER_BO=#{ew.entity.plannedWorkCenterBo}</if>
                    <if test="ew.entity.plannedItemBo!=null"> AND PLANNED_ITEM_BO=#{ew.entity.plannedItemBo}</if>
                    <if test="ew.entity.plannedBomBo!=null"> AND PLANNED_BOM_BO=#{ew.entity.plannedBomBo}</if>
                    <if test="ew.entity.plannedRouterBo!=null"> AND PLANNED_ROUTER_BO=#{ew.entity.plannedRouterBo}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
                    <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
                    <if test="ew.entity.qtyToBuild!=null"> AND QTY_TO_BUILD=#{ew.entity.qtyToBuild}</if>
                    <if test="ew.entity.qtyOrdered!=null"> AND QTY_ORDERED=#{ew.entity.qtyOrdered}</if>
                    <if test="ew.entity.qtyReleased!=null"> AND QTY_RELEASED=#{ew.entity.qtyReleased}</if>
                    <if test="ew.entity.releasedDate!=null"> AND RELEASED_DATE=#{ew.entity.releasedDate}</if>
                    <if test="ew.entity.plannedStartDate!=null"> AND PLANNED_START_DATE=#{ew.entity.plannedStartDate}</if>
                    <if test="ew.entity.plannedCompDate!=null"> AND PLANNED_COMP_DATE=#{ew.entity.plannedCompDate}</if>
                    <if test="ew.entity.scheduledStartDate!=null"> AND SCHEDULED_START_DATE=#{ew.entity.scheduledStartDate}</if>
                    <if test="ew.entity.scheduledCompDate!=null"> AND SCHEDULED_COMP_DATE=#{ew.entity.scheduledCompDate}</if>
                    <if test="ew.entity.actualStartDate!=null"> AND ACTUAL_START_DATE=#{ew.entity.actualStartDate}</if>
                    <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
                    <if test="ew.entity.qtyDone!=null"> AND QTY_DONE=#{ew.entity.qtyDone}</if>
                    <if test="ew.entity.qtyScrapped!=null"> AND QTY_SCRAPPED=#{ew.entity.qtyScrapped}</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.customer!=null"> AND CUSTOMER=#{ew.entity.customer}</if>
                    <if test="ew.entity.customerOrder!=null"> AND CUSTOMER_ORDER=#{ew.entity.customerOrder}</if>
                    <if test="ew.entity.rmaSfcDataTypeBo!=null"> AND RMA_SFC_DATA_TYPE_BO=#{ew.entity.rmaSfcDataTypeBo}</if>
                    <if test="ew.entity.rmaShopOrderDataTypeBo!=null"> AND RMA_SHOP_ORDER_DATA_TYPE_BO=#{ew.entity.rmaShopOrderDataTypeBo}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.transferSite!=null"> AND TRANSFER_SITE=#{ew.entity.transferSite}</if>
                    <if test="ew.entity.transferType!=null"> AND TRANSFER_TYPE=#{ew.entity.transferType}</if>
                    <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
                    <if test="ew.entity.shopOrderTypeBo!=null"> AND SHOP_ORDER_TYPE_BO=#{ew.entity.shopOrderTypeBo}</if>
                    <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
                    <if test="ew.entity.endUnitNumber!=null"> AND END_UNIT_NUMBER=#{ew.entity.endUnitNumber}</if>
                    <if test="ew.entity.reqSerialChange!=null"> AND REQ_SERIAL_CHANGE=#{ew.entity.reqSerialChange}</if>
                    <if test="ew.entity.collectParentSerial!=null"> AND COLLECT_PARENT_SERIAL=#{ew.entity.collectParentSerial}</if>
                    <if test="ew.entity.batchNumber!=null"> AND BATCH_NUMBER=#{ew.entity.batchNumber}</if>
                    <if test="ew.entity.erpOrder!=null"> AND ERP_ORDER=#{ew.entity.erpOrder}</if>
                    <if test="ew.entity.erpProductionVersion!=null"> AND ERP_PRODUCTION_VERSION=#{ew.entity.erpProductionVersion}</if>
                    <if test="ew.entity.erpUnitOfMeasure!=null"> AND ERP_UNIT_OF_MEASURE=#{ew.entity.erpUnitOfMeasure}</if>
                    <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
                    <if test="ew.entity.inspectionLot!=null"> AND INSPECTION_LOT=#{ew.entity.inspectionLot}</if>
                    <if test="ew.entity.inspectionGroupSize!=null"> AND INSPECTION_GROUP_SIZE=#{ew.entity.inspectionGroupSize}</if>
                    <if test="ew.entity.erpPutawayStorloc!=null"> AND ERP_PUTAWAY_STORLOC=#{ew.entity.erpPutawayStorloc}</if>
                    <if test="ew.entity.warehouseNumber!=null"> AND WAREHOUSE_NUMBER=#{ew.entity.warehouseNumber}</if>
                    <if test="ew.entity.underdeliveryTolerance!=null"> AND UNDERDELIVERY_TOLERANCE=#{ew.entity.underdeliveryTolerance}</if>
                    <if test="ew.entity.overdeliveryTolerance!=null"> AND OVERDELIVERY_TOLERANCE=#{ew.entity.overdeliveryTolerance}</if>
                    <if test="ew.entity.unlimitedOverdelivery!=null"> AND UNLIMITED_OVERDELIVERY=#{ew.entity.unlimitedOverdelivery}</if>
                    <if test="ew.entity.minimumDeliveryQty!=null"> AND MINIMUM_DELIVERY_QTY=#{ew.entity.minimumDeliveryQty}</if>
                    <if test="ew.entity.maximumDeliveryQty!=null"> AND MAXIMUM_DELIVERY_QTY=#{ew.entity.maximumDeliveryQty}</if>
                    <if test="ew.entity.toleranceDefinedIn!=null"> AND TOLERANCE_DEFINED_IN=#{ew.entity.toleranceDefinedIn}</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.ShopOrder">
        INSERT INTO SHOP_ORDER
        <trim prefix="(" suffix=")" suffixOverrides=",">
            HANDLE,
            <if test="changeStamp!=null">CHANGE_STAMP,</if>
            <if test="site!=null">SITE,</if>
            <if test="shopOrder!=null">SHOP_ORDER,</if>
            <if test="statusBo!=null">STATUS_BO,</if>
            <if test="priority!=null">PRIORITY,</if>
            <if test="plannedWorkCenterBo!=null">PLANNED_WORK_CENTER_BO,</if>
            <if test="plannedItemBo!=null">PLANNED_ITEM_BO,</if>
            <if test="plannedBomBo!=null">PLANNED_BOM_BO,</if>
            <if test="plannedRouterBo!=null">PLANNED_ROUTER_BO,</if>
            <if test="itemBo!=null">ITEM_BO,</if>
            <if test="bomBo!=null">BOM_BO,</if>
            <if test="routerBo!=null">ROUTER_BO,</if>
            <if test="qtyToBuild!=null">QTY_TO_BUILD,</if>
            <if test="qtyOrdered!=null">QTY_ORDERED,</if>
            <if test="qtyReleased!=null">QTY_RELEASED,</if>
            <if test="releasedDate!=null">RELEASED_DATE,</if>
            <if test="plannedStartDate!=null">PLANNED_START_DATE,</if>
            <if test="plannedCompDate!=null">PLANNED_COMP_DATE,</if>
            <if test="scheduledStartDate!=null">SCHEDULED_START_DATE,</if>
            <if test="scheduledCompDate!=null">SCHEDULED_COMP_DATE,</if>
            <if test="actualStartDate!=null">ACTUAL_START_DATE,</if>
            <if test="actualCompDate!=null">ACTUAL_COMP_DATE,</if>
            <if test="qtyDone!=null">QTY_DONE,</if>
            <if test="qtyScrapped!=null">QTY_SCRAPPED,</if>
            <if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
            <if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
            <if test="customer!=null">CUSTOMER,</if>
            <if test="customerOrder!=null">CUSTOMER_ORDER,</if>
            <if test="rmaSfcDataTypeBo!=null">RMA_SFC_DATA_TYPE_BO,</if>
            <if test="rmaShopOrderDataTypeBo!=null">RMA_SHOP_ORDER_DATA_TYPE_BO,</if>
            <if test="originalStatusBo!=null">ORIGINAL_STATUS_BO,</if>
            <if test="transferSite!=null">TRANSFER_SITE,</if>
            <if test="transferType!=null">TRANSFER_TYPE,</if>
            <if test="lccBo!=null">LCC_BO,</if>
            <if test="shopOrderTypeBo!=null">SHOP_ORDER_TYPE_BO,</if>
            <if test="holdId!=null">HOLD_ID,</if>
            <if test="endUnitNumber!=null">END_UNIT_NUMBER,</if>
            <if test="reqSerialChange!=null">REQ_SERIAL_CHANGE,</if>
            <if test="collectParentSerial!=null">COLLECT_PARENT_SERIAL,</if>
            <if test="batchNumber!=null">BATCH_NUMBER,</if>
            <if test="erpOrder!=null">ERP_ORDER,</if>
            <if test="erpProductionVersion!=null">ERP_PRODUCTION_VERSION,</if>
            <if test="erpUnitOfMeasure!=null">ERP_UNIT_OF_MEASURE,</if>
            <if test="partitionDate!=null">PARTITION_DATE,</if>
            <if test="inspectionLot!=null">INSPECTION_LOT,</if>
            <if test="inspectionGroupSize!=null">INSPECTION_GROUP_SIZE,</if>
            <if test="erpPutawayStorloc!=null">ERP_PUTAWAY_STORLOC,</if>
            <if test="warehouseNumber!=null">WAREHOUSE_NUMBER,</if>
            <if test="underdeliveryTolerance!=null">UNDERDELIVERY_TOLERANCE,</if>
            <if test="overdeliveryTolerance!=null">OVERDELIVERY_TOLERANCE,</if>
            <if test="unlimitedOverdelivery!=null">UNLIMITED_OVERDELIVERY,</if>
            <if test="minimumDeliveryQty!=null">MINIMUM_DELIVERY_QTY,</if>
            <if test="maximumDeliveryQty!=null">MAXIMUM_DELIVERY_QTY,</if>
            <if test="toleranceDefinedIn!=null">TOLERANCE_DEFINED_IN,</if>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            <if test="changeStamp!=null">#{changeStamp},</if>
            <if test="site!=null">#{site},</if>
            <if test="shopOrder!=null">#{shopOrder},</if>
            <if test="statusBo!=null">#{statusBo},</if>
            <if test="priority!=null">#{priority},</if>
            <if test="plannedWorkCenterBo!=null">#{plannedWorkCenterBo},</if>
            <if test="plannedItemBo!=null">#{plannedItemBo},</if>
            <if test="plannedBomBo!=null">#{plannedBomBo},</if>
            <if test="plannedRouterBo!=null">#{plannedRouterBo},</if>
            <if test="itemBo!=null">#{itemBo},</if>
            <if test="bomBo!=null">#{bomBo},</if>
            <if test="routerBo!=null">#{routerBo},</if>
            <if test="qtyToBuild!=null">#{qtyToBuild},</if>
            <if test="qtyOrdered!=null">#{qtyOrdered},</if>
            <if test="qtyReleased!=null">#{qtyReleased},</if>
            <if test="releasedDate!=null">#{releasedDate},</if>
            <if test="plannedStartDate!=null">#{plannedStartDate},</if>
            <if test="plannedCompDate!=null">#{plannedCompDate},</if>
            <if test="scheduledStartDate!=null">#{scheduledStartDate},</if>
            <if test="scheduledCompDate!=null">#{scheduledCompDate},</if>
            <if test="actualStartDate!=null">#{actualStartDate},</if>
            <if test="actualCompDate!=null">#{actualCompDate},</if>
            <if test="qtyDone!=null">#{qtyDone},</if>
            <if test="qtyScrapped!=null">#{qtyScrapped},</if>
            <if test="createdDateTime!=null">#{createdDateTime},</if>
            <if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
            <if test="customer!=null">#{customer},</if>
            <if test="customerOrder!=null">#{customerOrder},</if>
            <if test="rmaSfcDataTypeBo!=null">#{rmaSfcDataTypeBo},</if>
            <if test="rmaShopOrderDataTypeBo!=null">#{rmaShopOrderDataTypeBo},</if>
            <if test="originalStatusBo!=null">#{originalStatusBo},</if>
            <if test="transferSite!=null">#{transferSite},</if>
            <if test="transferType!=null">#{transferType},</if>
            <if test="lccBo!=null">#{lccBo},</if>
            <if test="shopOrderTypeBo!=null">#{shopOrderTypeBo},</if>
            <if test="holdId!=null">#{holdId},</if>
            <if test="endUnitNumber!=null">#{endUnitNumber},</if>
            <if test="reqSerialChange!=null">#{reqSerialChange},</if>
            <if test="collectParentSerial!=null">#{collectParentSerial},</if>
            <if test="batchNumber!=null">#{batchNumber},</if>
            <if test="erpOrder!=null">#{erpOrder},</if>
            <if test="erpProductionVersion!=null">#{erpProductionVersion},</if>
            <if test="erpUnitOfMeasure!=null">#{erpUnitOfMeasure},</if>
            <if test="partitionDate!=null">#{partitionDate},</if>
            <if test="inspectionLot!=null">#{inspectionLot},</if>
            <if test="inspectionGroupSize!=null">#{inspectionGroupSize},</if>
            <if test="erpPutawayStorloc!=null">#{erpPutawayStorloc},</if>
            <if test="warehouseNumber!=null">#{warehouseNumber},</if>
            <if test="underdeliveryTolerance!=null">#{underdeliveryTolerance},</if>
            <if test="overdeliveryTolerance!=null">#{overdeliveryTolerance},</if>
            <if test="unlimitedOverdelivery!=null">#{unlimitedOverdelivery},</if>
            <if test="minimumDeliveryQty!=null">#{minimumDeliveryQty},</if>
            <if test="maximumDeliveryQty!=null">#{maximumDeliveryQty},</if>
            <if test="toleranceDefinedIn!=null">#{toleranceDefinedIn},</if>
        </trim>
    </insert>

    <insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.meapi.model.ShopOrder">
        INSERT INTO SHOP_ORDER
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <include refid="Base_Column_List"></include>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            #{changeStamp},
            #{site},
            #{shopOrder},
            #{statusBo},
            #{priority},
            #{plannedWorkCenterBo},
            #{plannedItemBo},
            #{plannedBomBo},
            #{plannedRouterBo},
            #{itemBo},
            #{bomBo},
            #{routerBo},
            #{qtyToBuild},
            #{qtyOrdered},
            #{qtyReleased},
            #{releasedDate},
            #{plannedStartDate},
            #{plannedCompDate},
            #{scheduledStartDate},
            #{scheduledCompDate},
            #{actualStartDate},
            #{actualCompDate},
            #{qtyDone},
            #{qtyScrapped},
            #{createdDateTime},
            #{modifiedDateTime},
            #{customer},
            #{customerOrder},
            #{rmaSfcDataTypeBo},
            #{rmaShopOrderDataTypeBo},
            #{originalStatusBo},
            #{transferSite},
            #{transferType},
            #{lccBo},
            #{shopOrderTypeBo},
            #{holdId},
            #{endUnitNumber},
            #{reqSerialChange},
            #{collectParentSerial},
            #{batchNumber},
            #{erpOrder},
            #{erpProductionVersion},
            #{erpUnitOfMeasure},
            #{partitionDate},
            #{inspectionLot},
            #{inspectionGroupSize},
            #{erpPutawayStorloc},
            #{warehouseNumber},
            #{underdeliveryTolerance},
            #{overdeliveryTolerance},
            #{unlimitedOverdelivery},
            #{minimumDeliveryQty},
            #{maximumDeliveryQty},
            #{toleranceDefinedIn},
        </trim>
    </insert>






    <update id="update">
        UPDATE SHOP_ORDER <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.shopOrder!=null">SHOP_ORDER=#{et.shopOrder},</if>
        <if test="et.statusBo!=null">STATUS_BO=#{et.statusBo},</if>
        <if test="et.priority!=null">PRIORITY=#{et.priority},</if>
        <if test="et.plannedWorkCenterBo!=null">PLANNED_WORK_CENTER_BO=#{et.plannedWorkCenterBo},</if>
        <if test="et.plannedItemBo!=null">PLANNED_ITEM_BO=#{et.plannedItemBo},</if>
        <if test="et.plannedBomBo!=null">PLANNED_BOM_BO=#{et.plannedBomBo},</if>
        <if test="et.plannedRouterBo!=null">PLANNED_ROUTER_BO=#{et.plannedRouterBo},</if>
        <if test="et.itemBo!=null">ITEM_BO=#{et.itemBo},</if>
        <if test="et.bomBo!=null">BOM_BO=#{et.bomBo},</if>
        <if test="et.routerBo!=null">ROUTER_BO=#{et.routerBo},</if>
        <if test="et.qtyToBuild!=null">QTY_TO_BUILD=#{et.qtyToBuild},</if>
        <if test="et.qtyOrdered!=null">QTY_ORDERED=#{et.qtyOrdered},</if>
        <if test="et.qtyReleased!=null">QTY_RELEASED=#{et.qtyReleased},</if>
        <if test="et.releasedDate!=null">RELEASED_DATE=#{et.releasedDate},</if>
        <if test="et.plannedStartDate!=null">PLANNED_START_DATE=#{et.plannedStartDate},</if>
        <if test="et.plannedCompDate!=null">PLANNED_COMP_DATE=#{et.plannedCompDate},</if>
        <if test="et.scheduledStartDate!=null">SCHEDULED_START_DATE=#{et.scheduledStartDate},</if>
        <if test="et.scheduledCompDate!=null">SCHEDULED_COMP_DATE=#{et.scheduledCompDate},</if>
        <if test="et.actualStartDate!=null">ACTUAL_START_DATE=#{et.actualStartDate},</if>
        <if test="et.actualCompDate!=null">ACTUAL_COMP_DATE=#{et.actualCompDate},</if>
        <if test="et.qtyDone!=null">QTY_DONE=#{et.qtyDone},</if>
        <if test="et.qtyScrapped!=null">QTY_SCRAPPED=#{et.qtyScrapped},</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.customer!=null">CUSTOMER=#{et.customer},</if>
        <if test="et.customerOrder!=null">CUSTOMER_ORDER=#{et.customerOrder},</if>
        <if test="et.rmaSfcDataTypeBo!=null">RMA_SFC_DATA_TYPE_BO=#{et.rmaSfcDataTypeBo},</if>
        <if test="et.rmaShopOrderDataTypeBo!=null">RMA_SHOP_ORDER_DATA_TYPE_BO=#{et.rmaShopOrderDataTypeBo},</if>
        <if test="et.originalStatusBo!=null">ORIGINAL_STATUS_BO=#{et.originalStatusBo},</if>
        <if test="et.transferSite!=null">TRANSFER_SITE=#{et.transferSite},</if>
        <if test="et.transferType!=null">TRANSFER_TYPE=#{et.transferType},</if>
        <if test="et.lccBo!=null">LCC_BO=#{et.lccBo},</if>
        <if test="et.shopOrderTypeBo!=null">SHOP_ORDER_TYPE_BO=#{et.shopOrderTypeBo},</if>
        <if test="et.holdId!=null">HOLD_ID=#{et.holdId},</if>
        <if test="et.endUnitNumber!=null">END_UNIT_NUMBER=#{et.endUnitNumber},</if>
        <if test="et.reqSerialChange!=null">REQ_SERIAL_CHANGE=#{et.reqSerialChange},</if>
        <if test="et.collectParentSerial!=null">COLLECT_PARENT_SERIAL=#{et.collectParentSerial},</if>
        <if test="et.batchNumber!=null">BATCH_NUMBER=#{et.batchNumber},</if>
        <if test="et.erpOrder!=null">ERP_ORDER=#{et.erpOrder},</if>
        <if test="et.erpProductionVersion!=null">ERP_PRODUCTION_VERSION=#{et.erpProductionVersion},</if>
        <if test="et.erpUnitOfMeasure!=null">ERP_UNIT_OF_MEASURE=#{et.erpUnitOfMeasure},</if>
        <if test="et.partitionDate!=null">PARTITION_DATE=#{et.partitionDate},</if>
        <if test="et.inspectionLot!=null">INSPECTION_LOT=#{et.inspectionLot},</if>
        <if test="et.inspectionGroupSize!=null">INSPECTION_GROUP_SIZE=#{et.inspectionGroupSize},</if>
        <if test="et.erpPutawayStorloc!=null">ERP_PUTAWAY_STORLOC=#{et.erpPutawayStorloc},</if>
        <if test="et.warehouseNumber!=null">WAREHOUSE_NUMBER=#{et.warehouseNumber},</if>
        <if test="et.underdeliveryTolerance!=null">UNDERDELIVERY_TOLERANCE=#{et.underdeliveryTolerance},</if>
        <if test="et.overdeliveryTolerance!=null">OVERDELIVERY_TOLERANCE=#{et.overdeliveryTolerance},</if>
        <if test="et.unlimitedOverdelivery!=null">UNLIMITED_OVERDELIVERY=#{et.unlimitedOverdelivery},</if>
        <if test="et.minimumDeliveryQty!=null">MINIMUM_DELIVERY_QTY=#{et.minimumDeliveryQty},</if>
        <if test="et.maximumDeliveryQty!=null">MAXIMUM_DELIVERY_QTY=#{et.maximumDeliveryQty},</if>
        <if test="et.toleranceDefinedIn!=null">TOLERANCE_DEFINED_IN=#{et.toleranceDefinedIn},</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.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
                    <if test="ew.entity.plannedWorkCenterBo!=null"> AND PLANNED_WORK_CENTER_BO=#{ew.entity.plannedWorkCenterBo}</if>
                    <if test="ew.entity.plannedItemBo!=null"> AND PLANNED_ITEM_BO=#{ew.entity.plannedItemBo}</if>
                    <if test="ew.entity.plannedBomBo!=null"> AND PLANNED_BOM_BO=#{ew.entity.plannedBomBo}</if>
                    <if test="ew.entity.plannedRouterBo!=null"> AND PLANNED_ROUTER_BO=#{ew.entity.plannedRouterBo}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
                    <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
                    <if test="ew.entity.qtyToBuild!=null"> AND QTY_TO_BUILD=#{ew.entity.qtyToBuild}</if>
                    <if test="ew.entity.qtyOrdered!=null"> AND QTY_ORDERED=#{ew.entity.qtyOrdered}</if>
                    <if test="ew.entity.qtyReleased!=null"> AND QTY_RELEASED=#{ew.entity.qtyReleased}</if>
                    <if test="ew.entity.releasedDate!=null"> AND RELEASED_DATE=#{ew.entity.releasedDate}</if>
                    <if test="ew.entity.plannedStartDate!=null"> AND PLANNED_START_DATE=#{ew.entity.plannedStartDate}</if>
                    <if test="ew.entity.plannedCompDate!=null"> AND PLANNED_COMP_DATE=#{ew.entity.plannedCompDate}</if>
                    <if test="ew.entity.scheduledStartDate!=null"> AND SCHEDULED_START_DATE=#{ew.entity.scheduledStartDate}</if>
                    <if test="ew.entity.scheduledCompDate!=null"> AND SCHEDULED_COMP_DATE=#{ew.entity.scheduledCompDate}</if>
                    <if test="ew.entity.actualStartDate!=null"> AND ACTUAL_START_DATE=#{ew.entity.actualStartDate}</if>
                    <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
                    <if test="ew.entity.qtyDone!=null"> AND QTY_DONE=#{ew.entity.qtyDone}</if>
                    <if test="ew.entity.qtyScrapped!=null"> AND QTY_SCRAPPED=#{ew.entity.qtyScrapped}</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.customer!=null"> AND CUSTOMER=#{ew.entity.customer}</if>
                    <if test="ew.entity.customerOrder!=null"> AND CUSTOMER_ORDER=#{ew.entity.customerOrder}</if>
                    <if test="ew.entity.rmaSfcDataTypeBo!=null"> AND RMA_SFC_DATA_TYPE_BO=#{ew.entity.rmaSfcDataTypeBo}</if>
                    <if test="ew.entity.rmaShopOrderDataTypeBo!=null"> AND RMA_SHOP_ORDER_DATA_TYPE_BO=#{ew.entity.rmaShopOrderDataTypeBo}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.transferSite!=null"> AND TRANSFER_SITE=#{ew.entity.transferSite}</if>
                    <if test="ew.entity.transferType!=null"> AND TRANSFER_TYPE=#{ew.entity.transferType}</if>
                    <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
                    <if test="ew.entity.shopOrderTypeBo!=null"> AND SHOP_ORDER_TYPE_BO=#{ew.entity.shopOrderTypeBo}</if>
                    <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
                    <if test="ew.entity.endUnitNumber!=null"> AND END_UNIT_NUMBER=#{ew.entity.endUnitNumber}</if>
                    <if test="ew.entity.reqSerialChange!=null"> AND REQ_SERIAL_CHANGE=#{ew.entity.reqSerialChange}</if>
                    <if test="ew.entity.collectParentSerial!=null"> AND COLLECT_PARENT_SERIAL=#{ew.entity.collectParentSerial}</if>
                    <if test="ew.entity.batchNumber!=null"> AND BATCH_NUMBER=#{ew.entity.batchNumber}</if>
                    <if test="ew.entity.erpOrder!=null"> AND ERP_ORDER=#{ew.entity.erpOrder}</if>
                    <if test="ew.entity.erpProductionVersion!=null"> AND ERP_PRODUCTION_VERSION=#{ew.entity.erpProductionVersion}</if>
                    <if test="ew.entity.erpUnitOfMeasure!=null"> AND ERP_UNIT_OF_MEASURE=#{ew.entity.erpUnitOfMeasure}</if>
                    <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
                    <if test="ew.entity.inspectionLot!=null"> AND INSPECTION_LOT=#{ew.entity.inspectionLot}</if>
                    <if test="ew.entity.inspectionGroupSize!=null"> AND INSPECTION_GROUP_SIZE=#{ew.entity.inspectionGroupSize}</if>
                    <if test="ew.entity.erpPutawayStorloc!=null"> AND ERP_PUTAWAY_STORLOC=#{ew.entity.erpPutawayStorloc}</if>
                    <if test="ew.entity.warehouseNumber!=null"> AND WAREHOUSE_NUMBER=#{ew.entity.warehouseNumber}</if>
                    <if test="ew.entity.underdeliveryTolerance!=null"> AND UNDERDELIVERY_TOLERANCE=#{ew.entity.underdeliveryTolerance}</if>
                    <if test="ew.entity.overdeliveryTolerance!=null"> AND OVERDELIVERY_TOLERANCE=#{ew.entity.overdeliveryTolerance}</if>
                    <if test="ew.entity.unlimitedOverdelivery!=null"> AND UNLIMITED_OVERDELIVERY=#{ew.entity.unlimitedOverdelivery}</if>
                    <if test="ew.entity.minimumDeliveryQty!=null"> AND MINIMUM_DELIVERY_QTY=#{ew.entity.minimumDeliveryQty}</if>
                    <if test="ew.entity.maximumDeliveryQty!=null"> AND MAXIMUM_DELIVERY_QTY=#{ew.entity.maximumDeliveryQty}</if>
                    <if test="ew.entity.toleranceDefinedIn!=null"> AND TOLERANCE_DEFINED_IN=#{ew.entity.toleranceDefinedIn}</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 SHOP_ORDER
        <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 SHOP_ORDER
        <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.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
                    <if test="ew.entity.plannedWorkCenterBo!=null"> AND PLANNED_WORK_CENTER_BO=#{ew.entity.plannedWorkCenterBo}</if>
                    <if test="ew.entity.plannedItemBo!=null"> AND PLANNED_ITEM_BO=#{ew.entity.plannedItemBo}</if>
                    <if test="ew.entity.plannedBomBo!=null"> AND PLANNED_BOM_BO=#{ew.entity.plannedBomBo}</if>
                    <if test="ew.entity.plannedRouterBo!=null"> AND PLANNED_ROUTER_BO=#{ew.entity.plannedRouterBo}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
                    <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
                    <if test="ew.entity.qtyToBuild!=null"> AND QTY_TO_BUILD=#{ew.entity.qtyToBuild}</if>
                    <if test="ew.entity.qtyOrdered!=null"> AND QTY_ORDERED=#{ew.entity.qtyOrdered}</if>
                    <if test="ew.entity.qtyReleased!=null"> AND QTY_RELEASED=#{ew.entity.qtyReleased}</if>
                    <if test="ew.entity.releasedDate!=null"> AND RELEASED_DATE=#{ew.entity.releasedDate}</if>
                    <if test="ew.entity.plannedStartDate!=null"> AND PLANNED_START_DATE=#{ew.entity.plannedStartDate}</if>
                    <if test="ew.entity.plannedCompDate!=null"> AND PLANNED_COMP_DATE=#{ew.entity.plannedCompDate}</if>
                    <if test="ew.entity.scheduledStartDate!=null"> AND SCHEDULED_START_DATE=#{ew.entity.scheduledStartDate}</if>
                    <if test="ew.entity.scheduledCompDate!=null"> AND SCHEDULED_COMP_DATE=#{ew.entity.scheduledCompDate}</if>
                    <if test="ew.entity.actualStartDate!=null"> AND ACTUAL_START_DATE=#{ew.entity.actualStartDate}</if>
                    <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
                    <if test="ew.entity.qtyDone!=null"> AND QTY_DONE=#{ew.entity.qtyDone}</if>
                    <if test="ew.entity.qtyScrapped!=null"> AND QTY_SCRAPPED=#{ew.entity.qtyScrapped}</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.customer!=null"> AND CUSTOMER=#{ew.entity.customer}</if>
                    <if test="ew.entity.customerOrder!=null"> AND CUSTOMER_ORDER=#{ew.entity.customerOrder}</if>
                    <if test="ew.entity.rmaSfcDataTypeBo!=null"> AND RMA_SFC_DATA_TYPE_BO=#{ew.entity.rmaSfcDataTypeBo}</if>
                    <if test="ew.entity.rmaShopOrderDataTypeBo!=null"> AND RMA_SHOP_ORDER_DATA_TYPE_BO=#{ew.entity.rmaShopOrderDataTypeBo}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.transferSite!=null"> AND TRANSFER_SITE=#{ew.entity.transferSite}</if>
                    <if test="ew.entity.transferType!=null"> AND TRANSFER_TYPE=#{ew.entity.transferType}</if>
                    <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
                    <if test="ew.entity.shopOrderTypeBo!=null"> AND SHOP_ORDER_TYPE_BO=#{ew.entity.shopOrderTypeBo}</if>
                    <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
                    <if test="ew.entity.endUnitNumber!=null"> AND END_UNIT_NUMBER=#{ew.entity.endUnitNumber}</if>
                    <if test="ew.entity.reqSerialChange!=null"> AND REQ_SERIAL_CHANGE=#{ew.entity.reqSerialChange}</if>
                    <if test="ew.entity.collectParentSerial!=null"> AND COLLECT_PARENT_SERIAL=#{ew.entity.collectParentSerial}</if>
                    <if test="ew.entity.batchNumber!=null"> AND BATCH_NUMBER=#{ew.entity.batchNumber}</if>
                    <if test="ew.entity.erpOrder!=null"> AND ERP_ORDER=#{ew.entity.erpOrder}</if>
                    <if test="ew.entity.erpProductionVersion!=null"> AND ERP_PRODUCTION_VERSION=#{ew.entity.erpProductionVersion}</if>
                    <if test="ew.entity.erpUnitOfMeasure!=null"> AND ERP_UNIT_OF_MEASURE=#{ew.entity.erpUnitOfMeasure}</if>
                    <if test="ew.entity.partitionDate!=null"> AND PARTITION_DATE=#{ew.entity.partitionDate}</if>
                    <if test="ew.entity.inspectionLot!=null"> AND INSPECTION_LOT=#{ew.entity.inspectionLot}</if>
                    <if test="ew.entity.inspectionGroupSize!=null"> AND INSPECTION_GROUP_SIZE=#{ew.entity.inspectionGroupSize}</if>
                    <if test="ew.entity.erpPutawayStorloc!=null"> AND ERP_PUTAWAY_STORLOC=#{ew.entity.erpPutawayStorloc}</if>
                    <if test="ew.entity.warehouseNumber!=null"> AND WAREHOUSE_NUMBER=#{ew.entity.warehouseNumber}</if>
                    <if test="ew.entity.underdeliveryTolerance!=null"> AND UNDERDELIVERY_TOLERANCE=#{ew.entity.underdeliveryTolerance}</if>
                    <if test="ew.entity.overdeliveryTolerance!=null"> AND OVERDELIVERY_TOLERANCE=#{ew.entity.overdeliveryTolerance}</if>
                    <if test="ew.entity.unlimitedOverdelivery!=null"> AND UNLIMITED_OVERDELIVERY=#{ew.entity.unlimitedOverdelivery}</if>
                    <if test="ew.entity.minimumDeliveryQty!=null"> AND MINIMUM_DELIVERY_QTY=#{ew.entity.minimumDeliveryQty}</if>
                    <if test="ew.entity.maximumDeliveryQty!=null"> AND MAXIMUM_DELIVERY_QTY=#{ew.entity.maximumDeliveryQty}</if>
                    <if test="ew.entity.toleranceDefinedIn!=null"> AND TOLERANCE_DEFINED_IN=#{ew.entity.toleranceDefinedIn}</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>
