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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.foreverwin.mesnac.meapi.model.Sfc">
        <result column="HANDLE" property="handle" />
        <result column="CHANGE_STAMP" property="changeStamp" />
        <result column="SITE" property="site" />
        <result column="SFC" property="sfc" />
        <result column="STATUS_BO" property="statusBo" />
        <result column="SHOP_ORDER_BO" property="shopOrderBo" />
        <result column="QTY" property="qty" />
        <result column="QTY_DONE" property="qtyDone" />
        <result column="QTY_SCRAPPED" property="qtyScrapped" />
        <result column="QTY_HISTORICAL_MIN" property="qtyHistoricalMin" />
        <result column="QTY_HISTORICAL_MAX" property="qtyHistoricalMax" />
        <result column="ITEM_BO" property="itemBo" />
        <result column="PRIORITY" property="priority" />
        <result column="LOCATION" property="location" />
        <result column="RMA_MAX_TIMES_PROCESSED" property="rmaMaxTimesProcessed" />
        <result column="LCC_BO" property="lccBo" />
        <result column="ORIGINAL_STATUS_BO" property="originalStatusBo" />
        <result column="QTY_MULT_PERFORMED" property="qtyMultPerformed" />
        <result column="ACTUAL_COMP_DATE" property="actualCompDate" />
        <result column="PREV_SITE" property="prevSite" />
        <result column="ORIGINAL_TRANSFER_KEY" property="originalTransferKey" />
        <result column="IMMEDIATE_ARCHIVE" property="immediateArchive" />
        <result column="TRANSFER_DATETIME" property="transferDatetime" />
        <result column="TRANSFER_USER" property="transferUser" />
        <result column="SN_DONE" property="snDone" />
        <result column="AIN_EQUIPMENT_ID" property="ainEquipmentId" />
        <result column="CREATED_DATE_TIME" property="createdDateTime" />
        <result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
        <result column="PARTITION_DATE" property="partitionDate" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        HANDLE, CHANGE_STAMP, SITE, SFC, STATUS_BO, SHOP_ORDER_BO, QTY, QTY_DONE, QTY_SCRAPPED, QTY_HISTORICAL_MIN, QTY_HISTORICAL_MAX, ITEM_BO, PRIORITY, LOCATION, RMA_MAX_TIMES_PROCESSED, LCC_BO, ORIGINAL_STATUS_BO, QTY_MULT_PERFORMED, ACTUAL_COMP_DATE, PREV_SITE, ORIGINAL_TRANSFER_KEY, IMMEDIATE_ARCHIVE, TRANSFER_DATETIME, TRANSFER_USER, SN_DONE, AIN_EQUIPMENT_ID, CREATED_DATE_TIME, MODIFIED_DATE_TIME, PARTITION_DATE
    </sql>

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

    <select id="selectByMap" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include>
        FROM SFC
        <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 SFC
        <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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
            <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
            <if test="ew.entity.shopOrderBo!=null"> AND SHOP_ORDER_BO=#{ew.entity.shopOrderBo}</if>
            <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</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.qtyHistoricalMin!=null"> AND QTY_HISTORICAL_MIN=#{ew.entity.qtyHistoricalMin}</if>
            <if test="ew.entity.qtyHistoricalMax!=null"> AND QTY_HISTORICAL_MAX=#{ew.entity.qtyHistoricalMax}</if>
            <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
            <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
            <if test="ew.entity.location!=null"> AND LOCATION=#{ew.entity.location}</if>
            <if test="ew.entity.rmaMaxTimesProcessed!=null"> AND RMA_MAX_TIMES_PROCESSED=#{ew.entity.rmaMaxTimesProcessed}</if>
            <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
            <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
            <if test="ew.entity.qtyMultPerformed!=null"> AND QTY_MULT_PERFORMED=#{ew.entity.qtyMultPerformed}</if>
            <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
            <if test="ew.entity.prevSite!=null"> AND PREV_SITE=#{ew.entity.prevSite}</if>
            <if test="ew.entity.originalTransferKey!=null"> AND ORIGINAL_TRANSFER_KEY=#{ew.entity.originalTransferKey}</if>
            <if test="ew.entity.immediateArchive!=null"> AND IMMEDIATE_ARCHIVE=#{ew.entity.immediateArchive}</if>
            <if test="ew.entity.transferDatetime!=null"> AND TRANSFER_DATETIME=#{ew.entity.transferDatetime}</if>
            <if test="ew.entity.transferUser!=null"> AND TRANSFER_USER=#{ew.entity.transferUser}</if>
            <if test="ew.entity.snDone!=null"> AND SN_DONE=#{ew.entity.snDone}</if>
            <if test="ew.entity.ainEquipmentId!=null"> AND AIN_EQUIPMENT_ID=#{ew.entity.ainEquipmentId}</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>
        </where>
    </select>

    <select id="selectCount" resultType="Integer">
        SELECT COUNT(1) FROM SFC
        <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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                <if test="ew.entity.shopOrderBo!=null"> AND SHOP_ORDER_BO=#{ew.entity.shopOrderBo}</if>
                <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</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.qtyHistoricalMin!=null"> AND QTY_HISTORICAL_MIN=#{ew.entity.qtyHistoricalMin}</if>
                <if test="ew.entity.qtyHistoricalMax!=null"> AND QTY_HISTORICAL_MAX=#{ew.entity.qtyHistoricalMax}</if>
                <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
                <if test="ew.entity.location!=null"> AND LOCATION=#{ew.entity.location}</if>
                <if test="ew.entity.rmaMaxTimesProcessed!=null"> AND RMA_MAX_TIMES_PROCESSED=#{ew.entity.rmaMaxTimesProcessed}</if>
                <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
                <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                <if test="ew.entity.qtyMultPerformed!=null"> AND QTY_MULT_PERFORMED=#{ew.entity.qtyMultPerformed}</if>
                <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
                <if test="ew.entity.prevSite!=null"> AND PREV_SITE=#{ew.entity.prevSite}</if>
                <if test="ew.entity.originalTransferKey!=null"> AND ORIGINAL_TRANSFER_KEY=#{ew.entity.originalTransferKey}</if>
                <if test="ew.entity.immediateArchive!=null"> AND IMMEDIATE_ARCHIVE=#{ew.entity.immediateArchive}</if>
                <if test="ew.entity.transferDatetime!=null"> AND TRANSFER_DATETIME=#{ew.entity.transferDatetime}</if>
                <if test="ew.entity.transferUser!=null"> AND TRANSFER_USER=#{ew.entity.transferUser}</if>
                <if test="ew.entity.snDone!=null"> AND SN_DONE=#{ew.entity.snDone}</if>
                <if test="ew.entity.ainEquipmentId!=null"> AND AIN_EQUIPMENT_ID=#{ew.entity.ainEquipmentId}</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>
                <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 SFC
        <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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.shopOrderBo!=null"> AND SHOP_ORDER_BO=#{ew.entity.shopOrderBo}</if>
                    <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</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.qtyHistoricalMin!=null"> AND QTY_HISTORICAL_MIN=#{ew.entity.qtyHistoricalMin}</if>
                    <if test="ew.entity.qtyHistoricalMax!=null"> AND QTY_HISTORICAL_MAX=#{ew.entity.qtyHistoricalMax}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
                    <if test="ew.entity.location!=null"> AND LOCATION=#{ew.entity.location}</if>
                    <if test="ew.entity.rmaMaxTimesProcessed!=null"> AND RMA_MAX_TIMES_PROCESSED=#{ew.entity.rmaMaxTimesProcessed}</if>
                    <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.qtyMultPerformed!=null"> AND QTY_MULT_PERFORMED=#{ew.entity.qtyMultPerformed}</if>
                    <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
                    <if test="ew.entity.prevSite!=null"> AND PREV_SITE=#{ew.entity.prevSite}</if>
                    <if test="ew.entity.originalTransferKey!=null"> AND ORIGINAL_TRANSFER_KEY=#{ew.entity.originalTransferKey}</if>
                    <if test="ew.entity.immediateArchive!=null"> AND IMMEDIATE_ARCHIVE=#{ew.entity.immediateArchive}</if>
                    <if test="ew.entity.transferDatetime!=null"> AND TRANSFER_DATETIME=#{ew.entity.transferDatetime}</if>
                    <if test="ew.entity.transferUser!=null"> AND TRANSFER_USER=#{ew.entity.transferUser}</if>
                    <if test="ew.entity.snDone!=null"> AND SN_DONE=#{ew.entity.snDone}</if>
                    <if test="ew.entity.ainEquipmentId!=null"> AND AIN_EQUIPMENT_ID=#{ew.entity.ainEquipmentId}</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>
                <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 SFC
        <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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.shopOrderBo!=null"> AND SHOP_ORDER_BO=#{ew.entity.shopOrderBo}</if>
                    <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</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.qtyHistoricalMin!=null"> AND QTY_HISTORICAL_MIN=#{ew.entity.qtyHistoricalMin}</if>
                    <if test="ew.entity.qtyHistoricalMax!=null"> AND QTY_HISTORICAL_MAX=#{ew.entity.qtyHistoricalMax}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
                    <if test="ew.entity.location!=null"> AND LOCATION=#{ew.entity.location}</if>
                    <if test="ew.entity.rmaMaxTimesProcessed!=null"> AND RMA_MAX_TIMES_PROCESSED=#{ew.entity.rmaMaxTimesProcessed}</if>
                    <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.qtyMultPerformed!=null"> AND QTY_MULT_PERFORMED=#{ew.entity.qtyMultPerformed}</if>
                    <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
                    <if test="ew.entity.prevSite!=null"> AND PREV_SITE=#{ew.entity.prevSite}</if>
                    <if test="ew.entity.originalTransferKey!=null"> AND ORIGINAL_TRANSFER_KEY=#{ew.entity.originalTransferKey}</if>
                    <if test="ew.entity.immediateArchive!=null"> AND IMMEDIATE_ARCHIVE=#{ew.entity.immediateArchive}</if>
                    <if test="ew.entity.transferDatetime!=null"> AND TRANSFER_DATETIME=#{ew.entity.transferDatetime}</if>
                    <if test="ew.entity.transferUser!=null"> AND TRANSFER_USER=#{ew.entity.transferUser}</if>
                    <if test="ew.entity.snDone!=null"> AND SN_DONE=#{ew.entity.snDone}</if>
                    <if test="ew.entity.ainEquipmentId!=null"> AND AIN_EQUIPMENT_ID=#{ew.entity.ainEquipmentId}</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>
                <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 SFC
        <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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.shopOrderBo!=null"> AND SHOP_ORDER_BO=#{ew.entity.shopOrderBo}</if>
                    <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</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.qtyHistoricalMin!=null"> AND QTY_HISTORICAL_MIN=#{ew.entity.qtyHistoricalMin}</if>
                    <if test="ew.entity.qtyHistoricalMax!=null"> AND QTY_HISTORICAL_MAX=#{ew.entity.qtyHistoricalMax}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
                    <if test="ew.entity.location!=null"> AND LOCATION=#{ew.entity.location}</if>
                    <if test="ew.entity.rmaMaxTimesProcessed!=null"> AND RMA_MAX_TIMES_PROCESSED=#{ew.entity.rmaMaxTimesProcessed}</if>
                    <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.qtyMultPerformed!=null"> AND QTY_MULT_PERFORMED=#{ew.entity.qtyMultPerformed}</if>
                    <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
                    <if test="ew.entity.prevSite!=null"> AND PREV_SITE=#{ew.entity.prevSite}</if>
                    <if test="ew.entity.originalTransferKey!=null"> AND ORIGINAL_TRANSFER_KEY=#{ew.entity.originalTransferKey}</if>
                    <if test="ew.entity.immediateArchive!=null"> AND IMMEDIATE_ARCHIVE=#{ew.entity.immediateArchive}</if>
                    <if test="ew.entity.transferDatetime!=null"> AND TRANSFER_DATETIME=#{ew.entity.transferDatetime}</if>
                    <if test="ew.entity.transferUser!=null"> AND TRANSFER_USER=#{ew.entity.transferUser}</if>
                    <if test="ew.entity.snDone!=null"> AND SN_DONE=#{ew.entity.snDone}</if>
                    <if test="ew.entity.ainEquipmentId!=null"> AND AIN_EQUIPMENT_ID=#{ew.entity.ainEquipmentId}</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>
                <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 SFC
        <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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.shopOrderBo!=null"> AND SHOP_ORDER_BO=#{ew.entity.shopOrderBo}</if>
                    <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</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.qtyHistoricalMin!=null"> AND QTY_HISTORICAL_MIN=#{ew.entity.qtyHistoricalMin}</if>
                    <if test="ew.entity.qtyHistoricalMax!=null"> AND QTY_HISTORICAL_MAX=#{ew.entity.qtyHistoricalMax}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
                    <if test="ew.entity.location!=null"> AND LOCATION=#{ew.entity.location}</if>
                    <if test="ew.entity.rmaMaxTimesProcessed!=null"> AND RMA_MAX_TIMES_PROCESSED=#{ew.entity.rmaMaxTimesProcessed}</if>
                    <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.qtyMultPerformed!=null"> AND QTY_MULT_PERFORMED=#{ew.entity.qtyMultPerformed}</if>
                    <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
                    <if test="ew.entity.prevSite!=null"> AND PREV_SITE=#{ew.entity.prevSite}</if>
                    <if test="ew.entity.originalTransferKey!=null"> AND ORIGINAL_TRANSFER_KEY=#{ew.entity.originalTransferKey}</if>
                    <if test="ew.entity.immediateArchive!=null"> AND IMMEDIATE_ARCHIVE=#{ew.entity.immediateArchive}</if>
                    <if test="ew.entity.transferDatetime!=null"> AND TRANSFER_DATETIME=#{ew.entity.transferDatetime}</if>
                    <if test="ew.entity.transferUser!=null"> AND TRANSFER_USER=#{ew.entity.transferUser}</if>
                    <if test="ew.entity.snDone!=null"> AND SN_DONE=#{ew.entity.snDone}</if>
                    <if test="ew.entity.ainEquipmentId!=null"> AND AIN_EQUIPMENT_ID=#{ew.entity.ainEquipmentId}</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>
                <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 SFC
        <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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.shopOrderBo!=null"> AND SHOP_ORDER_BO=#{ew.entity.shopOrderBo}</if>
                    <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</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.qtyHistoricalMin!=null"> AND QTY_HISTORICAL_MIN=#{ew.entity.qtyHistoricalMin}</if>
                    <if test="ew.entity.qtyHistoricalMax!=null"> AND QTY_HISTORICAL_MAX=#{ew.entity.qtyHistoricalMax}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
                    <if test="ew.entity.location!=null"> AND LOCATION=#{ew.entity.location}</if>
                    <if test="ew.entity.rmaMaxTimesProcessed!=null"> AND RMA_MAX_TIMES_PROCESSED=#{ew.entity.rmaMaxTimesProcessed}</if>
                    <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.qtyMultPerformed!=null"> AND QTY_MULT_PERFORMED=#{ew.entity.qtyMultPerformed}</if>
                    <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
                    <if test="ew.entity.prevSite!=null"> AND PREV_SITE=#{ew.entity.prevSite}</if>
                    <if test="ew.entity.originalTransferKey!=null"> AND ORIGINAL_TRANSFER_KEY=#{ew.entity.originalTransferKey}</if>
                    <if test="ew.entity.immediateArchive!=null"> AND IMMEDIATE_ARCHIVE=#{ew.entity.immediateArchive}</if>
                    <if test="ew.entity.transferDatetime!=null"> AND TRANSFER_DATETIME=#{ew.entity.transferDatetime}</if>
                    <if test="ew.entity.transferUser!=null"> AND TRANSFER_USER=#{ew.entity.transferUser}</if>
                    <if test="ew.entity.snDone!=null"> AND SN_DONE=#{ew.entity.snDone}</if>
                    <if test="ew.entity.ainEquipmentId!=null"> AND AIN_EQUIPMENT_ID=#{ew.entity.ainEquipmentId}</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>
                <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.Sfc">
        INSERT INTO SFC
        <trim prefix="(" suffix=")" suffixOverrides=",">
            HANDLE,
            <if test="changeStamp!=null">CHANGE_STAMP,</if>
            <if test="site!=null">SITE,</if>
            <if test="sfc!=null">SFC,</if>
            <if test="statusBo!=null">STATUS_BO,</if>
            <if test="shopOrderBo!=null">SHOP_ORDER_BO,</if>
            <if test="qty!=null">QTY,</if>
            <if test="qtyDone!=null">QTY_DONE,</if>
            <if test="qtyScrapped!=null">QTY_SCRAPPED,</if>
            <if test="qtyHistoricalMin!=null">QTY_HISTORICAL_MIN,</if>
            <if test="qtyHistoricalMax!=null">QTY_HISTORICAL_MAX,</if>
            <if test="itemBo!=null">ITEM_BO,</if>
            <if test="priority!=null">PRIORITY,</if>
            <if test="location!=null">LOCATION,</if>
            <if test="rmaMaxTimesProcessed!=null">RMA_MAX_TIMES_PROCESSED,</if>
            <if test="lccBo!=null">LCC_BO,</if>
            <if test="originalStatusBo!=null">ORIGINAL_STATUS_BO,</if>
            <if test="qtyMultPerformed!=null">QTY_MULT_PERFORMED,</if>
            <if test="actualCompDate!=null">ACTUAL_COMP_DATE,</if>
            <if test="prevSite!=null">PREV_SITE,</if>
            <if test="originalTransferKey!=null">ORIGINAL_TRANSFER_KEY,</if>
            <if test="immediateArchive!=null">IMMEDIATE_ARCHIVE,</if>
            <if test="transferDatetime!=null">TRANSFER_DATETIME,</if>
            <if test="transferUser!=null">TRANSFER_USER,</if>
            <if test="snDone!=null">SN_DONE,</if>
            <if test="ainEquipmentId!=null">AIN_EQUIPMENT_ID,</if>
            <if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
            <if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
            <if test="partitionDate!=null">PARTITION_DATE,</if>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            <if test="changeStamp!=null">#{changeStamp},</if>
            <if test="site!=null">#{site},</if>
            <if test="sfc!=null">#{sfc},</if>
            <if test="statusBo!=null">#{statusBo},</if>
            <if test="shopOrderBo!=null">#{shopOrderBo},</if>
            <if test="qty!=null">#{qty},</if>
            <if test="qtyDone!=null">#{qtyDone},</if>
            <if test="qtyScrapped!=null">#{qtyScrapped},</if>
            <if test="qtyHistoricalMin!=null">#{qtyHistoricalMin},</if>
            <if test="qtyHistoricalMax!=null">#{qtyHistoricalMax},</if>
            <if test="itemBo!=null">#{itemBo},</if>
            <if test="priority!=null">#{priority},</if>
            <if test="location!=null">#{location},</if>
            <if test="rmaMaxTimesProcessed!=null">#{rmaMaxTimesProcessed},</if>
            <if test="lccBo!=null">#{lccBo},</if>
            <if test="originalStatusBo!=null">#{originalStatusBo},</if>
            <if test="qtyMultPerformed!=null">#{qtyMultPerformed},</if>
            <if test="actualCompDate!=null">#{actualCompDate},</if>
            <if test="prevSite!=null">#{prevSite},</if>
            <if test="originalTransferKey!=null">#{originalTransferKey},</if>
            <if test="immediateArchive!=null">#{immediateArchive},</if>
            <if test="transferDatetime!=null">#{transferDatetime},</if>
            <if test="transferUser!=null">#{transferUser},</if>
            <if test="snDone!=null">#{snDone},</if>
            <if test="ainEquipmentId!=null">#{ainEquipmentId},</if>
            <if test="createdDateTime!=null">#{createdDateTime},</if>
            <if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
            <if test="partitionDate!=null">#{partitionDate},</if>
        </trim>
    </insert>

    <insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.meapi.model.Sfc">
        INSERT INTO SFC
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <include refid="Base_Column_List"></include>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            #{changeStamp},
            #{site},
            #{sfc},
            #{statusBo},
            #{shopOrderBo},
            #{qty},
            #{qtyDone},
            #{qtyScrapped},
            #{qtyHistoricalMin},
            #{qtyHistoricalMax},
            #{itemBo},
            #{priority},
            #{location},
            #{rmaMaxTimesProcessed},
            #{lccBo},
            #{originalStatusBo},
            #{qtyMultPerformed},
            #{actualCompDate},
            #{prevSite},
            #{originalTransferKey},
            #{immediateArchive},
            #{transferDatetime},
            #{transferUser},
            #{snDone},
            #{ainEquipmentId},
            #{createdDateTime},
            #{modifiedDateTime},
            #{partitionDate},
        </trim>
    </insert>






    <update id="update">
        UPDATE SFC <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.sfc!=null">SFC=#{et.sfc},</if>
        <if test="et.statusBo!=null">STATUS_BO=#{et.statusBo},</if>
        <if test="et.shopOrderBo!=null">SHOP_ORDER_BO=#{et.shopOrderBo},</if>
        <if test="et.qty!=null">QTY=#{et.qty},</if>
        <if test="et.qtyDone!=null">QTY_DONE=#{et.qtyDone},</if>
        <if test="et.qtyScrapped!=null">QTY_SCRAPPED=#{et.qtyScrapped},</if>
        <if test="et.qtyHistoricalMin!=null">QTY_HISTORICAL_MIN=#{et.qtyHistoricalMin},</if>
        <if test="et.qtyHistoricalMax!=null">QTY_HISTORICAL_MAX=#{et.qtyHistoricalMax},</if>
        <if test="et.itemBo!=null">ITEM_BO=#{et.itemBo},</if>
        <if test="et.priority!=null">PRIORITY=#{et.priority},</if>
        <if test="et.location!=null">LOCATION=#{et.location},</if>
        <if test="et.rmaMaxTimesProcessed!=null">RMA_MAX_TIMES_PROCESSED=#{et.rmaMaxTimesProcessed},</if>
        <if test="et.lccBo!=null">LCC_BO=#{et.lccBo},</if>
        <if test="et.originalStatusBo!=null">ORIGINAL_STATUS_BO=#{et.originalStatusBo},</if>
        <if test="et.qtyMultPerformed!=null">QTY_MULT_PERFORMED=#{et.qtyMultPerformed},</if>
        <if test="et.actualCompDate!=null">ACTUAL_COMP_DATE=#{et.actualCompDate},</if>
        <if test="et.prevSite!=null">PREV_SITE=#{et.prevSite},</if>
        <if test="et.originalTransferKey!=null">ORIGINAL_TRANSFER_KEY=#{et.originalTransferKey},</if>
        <if test="et.immediateArchive!=null">IMMEDIATE_ARCHIVE=#{et.immediateArchive},</if>
        <if test="et.transferDatetime!=null">TRANSFER_DATETIME=#{et.transferDatetime},</if>
        <if test="et.transferUser!=null">TRANSFER_USER=#{et.transferUser},</if>
        <if test="et.snDone!=null">SN_DONE=#{et.snDone},</if>
        <if test="et.ainEquipmentId!=null">AIN_EQUIPMENT_ID=#{et.ainEquipmentId},</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>
    </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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.shopOrderBo!=null"> AND SHOP_ORDER_BO=#{ew.entity.shopOrderBo}</if>
                    <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</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.qtyHistoricalMin!=null"> AND QTY_HISTORICAL_MIN=#{ew.entity.qtyHistoricalMin}</if>
                    <if test="ew.entity.qtyHistoricalMax!=null"> AND QTY_HISTORICAL_MAX=#{ew.entity.qtyHistoricalMax}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
                    <if test="ew.entity.location!=null"> AND LOCATION=#{ew.entity.location}</if>
                    <if test="ew.entity.rmaMaxTimesProcessed!=null"> AND RMA_MAX_TIMES_PROCESSED=#{ew.entity.rmaMaxTimesProcessed}</if>
                    <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.qtyMultPerformed!=null"> AND QTY_MULT_PERFORMED=#{ew.entity.qtyMultPerformed}</if>
                    <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
                    <if test="ew.entity.prevSite!=null"> AND PREV_SITE=#{ew.entity.prevSite}</if>
                    <if test="ew.entity.originalTransferKey!=null"> AND ORIGINAL_TRANSFER_KEY=#{ew.entity.originalTransferKey}</if>
                    <if test="ew.entity.immediateArchive!=null"> AND IMMEDIATE_ARCHIVE=#{ew.entity.immediateArchive}</if>
                    <if test="ew.entity.transferDatetime!=null"> AND TRANSFER_DATETIME=#{ew.entity.transferDatetime}</if>
                    <if test="ew.entity.transferUser!=null"> AND TRANSFER_USER=#{ew.entity.transferUser}</if>
                    <if test="ew.entity.snDone!=null"> AND SN_DONE=#{ew.entity.snDone}</if>
                    <if test="ew.entity.ainEquipmentId!=null"> AND AIN_EQUIPMENT_ID=#{ew.entity.ainEquipmentId}</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>
                <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 SFC
        <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 SFC
        <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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.shopOrderBo!=null"> AND SHOP_ORDER_BO=#{ew.entity.shopOrderBo}</if>
                    <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</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.qtyHistoricalMin!=null"> AND QTY_HISTORICAL_MIN=#{ew.entity.qtyHistoricalMin}</if>
                    <if test="ew.entity.qtyHistoricalMax!=null"> AND QTY_HISTORICAL_MAX=#{ew.entity.qtyHistoricalMax}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</if>
                    <if test="ew.entity.location!=null"> AND LOCATION=#{ew.entity.location}</if>
                    <if test="ew.entity.rmaMaxTimesProcessed!=null"> AND RMA_MAX_TIMES_PROCESSED=#{ew.entity.rmaMaxTimesProcessed}</if>
                    <if test="ew.entity.lccBo!=null"> AND LCC_BO=#{ew.entity.lccBo}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.qtyMultPerformed!=null"> AND QTY_MULT_PERFORMED=#{ew.entity.qtyMultPerformed}</if>
                    <if test="ew.entity.actualCompDate!=null"> AND ACTUAL_COMP_DATE=#{ew.entity.actualCompDate}</if>
                    <if test="ew.entity.prevSite!=null"> AND PREV_SITE=#{ew.entity.prevSite}</if>
                    <if test="ew.entity.originalTransferKey!=null"> AND ORIGINAL_TRANSFER_KEY=#{ew.entity.originalTransferKey}</if>
                    <if test="ew.entity.immediateArchive!=null"> AND IMMEDIATE_ARCHIVE=#{ew.entity.immediateArchive}</if>
                    <if test="ew.entity.transferDatetime!=null"> AND TRANSFER_DATETIME=#{ew.entity.transferDatetime}</if>
                    <if test="ew.entity.transferUser!=null"> AND TRANSFER_USER=#{ew.entity.transferUser}</if>
                    <if test="ew.entity.snDone!=null"> AND SN_DONE=#{ew.entity.snDone}</if>
                    <if test="ew.entity.ainEquipmentId!=null"> AND AIN_EQUIPMENT_ID=#{ew.entity.ainEquipmentId}</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>
                <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标准查询/修改/删除 -->
    <select id="getSfcListByResrceBO" resultMap="BaseResultMap">
        SELECT S.SFC
        FROM RESRCE RES
        INNER JOIN SFC_IN_WORK IW ON IW.RESOURCE_BO = RES.HANDLE
        INNER JOIN SFC_STEP SS ON SS.HANDLE = IW.SFC_STEP_BO
        INNER JOIN SFC_ROUTER SRO ON SS.SFC_ROUTER_BO = SRO.HANDLE
        INNER JOIN SFC_ROUTING SR ON SRO.SFC_ROUTING_BO = SR.HANDLE
        INNER JOIN SFC S ON SR.SFC_BO = S.HANDLE
        INNER JOIN STATUS ST ON ST.HANDLE = S.STATUS_BO AND ST.STATUS ='403'
        WHERE RES.HANDLE = #{resrceBO}
        ORDER BY IW.DATE_STARTED DESC
    </select>
</mapper>
