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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.foreverwin.mesnac.meapi.model.Router">
        <result column="HANDLE" property="handle" />
        <result column="CHANGE_STAMP" property="changeStamp" />
        <result column="SITE" property="site" />
        <result column="ROUTER" property="router" />
        <result column="ROUTER_TYPE" property="routerType" />
        <result column="DESCRIPTION" property="description" />
        <result column="TEMPORARY_ROUTER" property="temporaryRouter" />
        <result column="STATUS_BO" property="statusBo" />
        <result column="ENTRY_ROUTER_STEP_BO" property="entryRouterStepBo" />
        <result column="COPIED_FROM_ROUTER_BO" property="copiedFromRouterBo" />
        <result column="REVISION" property="revision" />
        <result column="CURRENT_REVISION" property="currentRevision" />
        <result column="HAS_BEEN_RELEASED" property="hasBeenReleased" />
        <result column="EFF_START_DATE" property="effStartDate" />
        <result column="EFF_END_DATE" property="effEndDate" />
        <result column="CREATED_DATE_TIME" property="createdDateTime" />
        <result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
        <result column="GUI_REPRESENTATION" property="guiRepresentation" />
        <result column="ORIGINAL_STATUS_BO" property="originalStatusBo" />
        <result column="DISPOSITION_GROUP_BO" property="dispositionGroupBo" />
        <result column="PREV_SITE" property="prevSite" />
        <result column="ORIGINAL_TRANSFER_KEY" property="originalTransferKey" />
        <result column="DISPLAY_TYPE" property="displayType" />
        <result column="HOLD_ID" property="holdId" />
        <result column="SEND_AS_SHARED" property="sendAsShared" />
        <result column="SENT_TO_ERP" property="sentToErp" />
        <result column="ERP_CHANGE_NUMBER" property="erpChangeNumber" />
        <result column="RELAXED_FLOW" property="relaxedFlow" />
        <result column="BOM_BO" property="bomBo" />
        <result column="ORIGIN" property="origin" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        HANDLE, CHANGE_STAMP, SITE, ROUTER, ROUTER_TYPE, DESCRIPTION, TEMPORARY_ROUTER, STATUS_BO, ENTRY_ROUTER_STEP_BO, COPIED_FROM_ROUTER_BO, REVISION, CURRENT_REVISION, HAS_BEEN_RELEASED, EFF_START_DATE, EFF_END_DATE, CREATED_DATE_TIME, MODIFIED_DATE_TIME, GUI_REPRESENTATION, ORIGINAL_STATUS_BO, DISPOSITION_GROUP_BO, PREV_SITE, ORIGINAL_TRANSFER_KEY, DISPLAY_TYPE, HOLD_ID, SEND_AS_SHARED, SENT_TO_ERP, ERP_CHANGE_NUMBER, RELAXED_FLOW, BOM_BO, ORIGIN
    </sql>

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

    <select id="selectByMap" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include>
        FROM ROUTER
        <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 ROUTER
        <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.router!=null"> AND ROUTER=#{ew.entity.router}</if>
            <if test="ew.entity.routerType!=null"> AND ROUTER_TYPE=#{ew.entity.routerType}</if>
            <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
            <if test="ew.entity.temporaryRouter!=null"> AND TEMPORARY_ROUTER=#{ew.entity.temporaryRouter}</if>
            <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
            <if test="ew.entity.entryRouterStepBo!=null"> AND ENTRY_ROUTER_STEP_BO=#{ew.entity.entryRouterStepBo}</if>
            <if test="ew.entity.copiedFromRouterBo!=null"> AND COPIED_FROM_ROUTER_BO=#{ew.entity.copiedFromRouterBo}</if>
            <if test="ew.entity.revision!=null"> AND REVISION=#{ew.entity.revision}</if>
            <if test="ew.entity.currentRevision!=null"> AND CURRENT_REVISION=#{ew.entity.currentRevision}</if>
            <if test="ew.entity.hasBeenReleased!=null"> AND HAS_BEEN_RELEASED=#{ew.entity.hasBeenReleased}</if>
            <if test="ew.entity.effStartDate!=null"> AND EFF_START_DATE=#{ew.entity.effStartDate}</if>
            <if test="ew.entity.effEndDate!=null"> AND EFF_END_DATE=#{ew.entity.effEndDate}</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.guiRepresentation!=null"> AND GUI_REPRESENTATION=#{ew.entity.guiRepresentation}</if>
            <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
            <if test="ew.entity.dispositionGroupBo!=null"> AND DISPOSITION_GROUP_BO=#{ew.entity.dispositionGroupBo}</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.displayType!=null"> AND DISPLAY_TYPE=#{ew.entity.displayType}</if>
            <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
            <if test="ew.entity.sendAsShared!=null"> AND SEND_AS_SHARED=#{ew.entity.sendAsShared}</if>
            <if test="ew.entity.sentToErp!=null"> AND SENT_TO_ERP=#{ew.entity.sentToErp}</if>
            <if test="ew.entity.erpChangeNumber!=null"> AND ERP_CHANGE_NUMBER=#{ew.entity.erpChangeNumber}</if>
            <if test="ew.entity.relaxedFlow!=null"> AND RELAXED_FLOW=#{ew.entity.relaxedFlow}</if>
            <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
            <if test="ew.entity.origin!=null"> AND ORIGIN=#{ew.entity.origin}</if>
        </where>
    </select>

    <select id="selectCount" resultType="Integer">
        SELECT COUNT(1) FROM ROUTER
        <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.router!=null"> AND ROUTER=#{ew.entity.router}</if>
                <if test="ew.entity.routerType!=null"> AND ROUTER_TYPE=#{ew.entity.routerType}</if>
                <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
                <if test="ew.entity.temporaryRouter!=null"> AND TEMPORARY_ROUTER=#{ew.entity.temporaryRouter}</if>
                <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                <if test="ew.entity.entryRouterStepBo!=null"> AND ENTRY_ROUTER_STEP_BO=#{ew.entity.entryRouterStepBo}</if>
                <if test="ew.entity.copiedFromRouterBo!=null"> AND COPIED_FROM_ROUTER_BO=#{ew.entity.copiedFromRouterBo}</if>
                <if test="ew.entity.revision!=null"> AND REVISION=#{ew.entity.revision}</if>
                <if test="ew.entity.currentRevision!=null"> AND CURRENT_REVISION=#{ew.entity.currentRevision}</if>
                <if test="ew.entity.hasBeenReleased!=null"> AND HAS_BEEN_RELEASED=#{ew.entity.hasBeenReleased}</if>
                <if test="ew.entity.effStartDate!=null"> AND EFF_START_DATE=#{ew.entity.effStartDate}</if>
                <if test="ew.entity.effEndDate!=null"> AND EFF_END_DATE=#{ew.entity.effEndDate}</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.guiRepresentation!=null"> AND GUI_REPRESENTATION=#{ew.entity.guiRepresentation}</if>
                <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                <if test="ew.entity.dispositionGroupBo!=null"> AND DISPOSITION_GROUP_BO=#{ew.entity.dispositionGroupBo}</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.displayType!=null"> AND DISPLAY_TYPE=#{ew.entity.displayType}</if>
                <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
                <if test="ew.entity.sendAsShared!=null"> AND SEND_AS_SHARED=#{ew.entity.sendAsShared}</if>
                <if test="ew.entity.sentToErp!=null"> AND SENT_TO_ERP=#{ew.entity.sentToErp}</if>
                <if test="ew.entity.erpChangeNumber!=null"> AND ERP_CHANGE_NUMBER=#{ew.entity.erpChangeNumber}</if>
                <if test="ew.entity.relaxedFlow!=null"> AND RELAXED_FLOW=#{ew.entity.relaxedFlow}</if>
                <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
                <if test="ew.entity.origin!=null"> AND ORIGIN=#{ew.entity.origin}</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 ROUTER
        <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.router!=null"> AND ROUTER=#{ew.entity.router}</if>
                    <if test="ew.entity.routerType!=null"> AND ROUTER_TYPE=#{ew.entity.routerType}</if>
                    <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
                    <if test="ew.entity.temporaryRouter!=null"> AND TEMPORARY_ROUTER=#{ew.entity.temporaryRouter}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.entryRouterStepBo!=null"> AND ENTRY_ROUTER_STEP_BO=#{ew.entity.entryRouterStepBo}</if>
                    <if test="ew.entity.copiedFromRouterBo!=null"> AND COPIED_FROM_ROUTER_BO=#{ew.entity.copiedFromRouterBo}</if>
                    <if test="ew.entity.revision!=null"> AND REVISION=#{ew.entity.revision}</if>
                    <if test="ew.entity.currentRevision!=null"> AND CURRENT_REVISION=#{ew.entity.currentRevision}</if>
                    <if test="ew.entity.hasBeenReleased!=null"> AND HAS_BEEN_RELEASED=#{ew.entity.hasBeenReleased}</if>
                    <if test="ew.entity.effStartDate!=null"> AND EFF_START_DATE=#{ew.entity.effStartDate}</if>
                    <if test="ew.entity.effEndDate!=null"> AND EFF_END_DATE=#{ew.entity.effEndDate}</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.guiRepresentation!=null"> AND GUI_REPRESENTATION=#{ew.entity.guiRepresentation}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.dispositionGroupBo!=null"> AND DISPOSITION_GROUP_BO=#{ew.entity.dispositionGroupBo}</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.displayType!=null"> AND DISPLAY_TYPE=#{ew.entity.displayType}</if>
                    <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
                    <if test="ew.entity.sendAsShared!=null"> AND SEND_AS_SHARED=#{ew.entity.sendAsShared}</if>
                    <if test="ew.entity.sentToErp!=null"> AND SENT_TO_ERP=#{ew.entity.sentToErp}</if>
                    <if test="ew.entity.erpChangeNumber!=null"> AND ERP_CHANGE_NUMBER=#{ew.entity.erpChangeNumber}</if>
                    <if test="ew.entity.relaxedFlow!=null"> AND RELAXED_FLOW=#{ew.entity.relaxedFlow}</if>
                    <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
                    <if test="ew.entity.origin!=null"> AND ORIGIN=#{ew.entity.origin}</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 ROUTER
        <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.router!=null"> AND ROUTER=#{ew.entity.router}</if>
                    <if test="ew.entity.routerType!=null"> AND ROUTER_TYPE=#{ew.entity.routerType}</if>
                    <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
                    <if test="ew.entity.temporaryRouter!=null"> AND TEMPORARY_ROUTER=#{ew.entity.temporaryRouter}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.entryRouterStepBo!=null"> AND ENTRY_ROUTER_STEP_BO=#{ew.entity.entryRouterStepBo}</if>
                    <if test="ew.entity.copiedFromRouterBo!=null"> AND COPIED_FROM_ROUTER_BO=#{ew.entity.copiedFromRouterBo}</if>
                    <if test="ew.entity.revision!=null"> AND REVISION=#{ew.entity.revision}</if>
                    <if test="ew.entity.currentRevision!=null"> AND CURRENT_REVISION=#{ew.entity.currentRevision}</if>
                    <if test="ew.entity.hasBeenReleased!=null"> AND HAS_BEEN_RELEASED=#{ew.entity.hasBeenReleased}</if>
                    <if test="ew.entity.effStartDate!=null"> AND EFF_START_DATE=#{ew.entity.effStartDate}</if>
                    <if test="ew.entity.effEndDate!=null"> AND EFF_END_DATE=#{ew.entity.effEndDate}</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.guiRepresentation!=null"> AND GUI_REPRESENTATION=#{ew.entity.guiRepresentation}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.dispositionGroupBo!=null"> AND DISPOSITION_GROUP_BO=#{ew.entity.dispositionGroupBo}</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.displayType!=null"> AND DISPLAY_TYPE=#{ew.entity.displayType}</if>
                    <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
                    <if test="ew.entity.sendAsShared!=null"> AND SEND_AS_SHARED=#{ew.entity.sendAsShared}</if>
                    <if test="ew.entity.sentToErp!=null"> AND SENT_TO_ERP=#{ew.entity.sentToErp}</if>
                    <if test="ew.entity.erpChangeNumber!=null"> AND ERP_CHANGE_NUMBER=#{ew.entity.erpChangeNumber}</if>
                    <if test="ew.entity.relaxedFlow!=null"> AND RELAXED_FLOW=#{ew.entity.relaxedFlow}</if>
                    <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
                    <if test="ew.entity.origin!=null"> AND ORIGIN=#{ew.entity.origin}</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 ROUTER
        <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.router!=null"> AND ROUTER=#{ew.entity.router}</if>
                    <if test="ew.entity.routerType!=null"> AND ROUTER_TYPE=#{ew.entity.routerType}</if>
                    <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
                    <if test="ew.entity.temporaryRouter!=null"> AND TEMPORARY_ROUTER=#{ew.entity.temporaryRouter}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.entryRouterStepBo!=null"> AND ENTRY_ROUTER_STEP_BO=#{ew.entity.entryRouterStepBo}</if>
                    <if test="ew.entity.copiedFromRouterBo!=null"> AND COPIED_FROM_ROUTER_BO=#{ew.entity.copiedFromRouterBo}</if>
                    <if test="ew.entity.revision!=null"> AND REVISION=#{ew.entity.revision}</if>
                    <if test="ew.entity.currentRevision!=null"> AND CURRENT_REVISION=#{ew.entity.currentRevision}</if>
                    <if test="ew.entity.hasBeenReleased!=null"> AND HAS_BEEN_RELEASED=#{ew.entity.hasBeenReleased}</if>
                    <if test="ew.entity.effStartDate!=null"> AND EFF_START_DATE=#{ew.entity.effStartDate}</if>
                    <if test="ew.entity.effEndDate!=null"> AND EFF_END_DATE=#{ew.entity.effEndDate}</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.guiRepresentation!=null"> AND GUI_REPRESENTATION=#{ew.entity.guiRepresentation}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.dispositionGroupBo!=null"> AND DISPOSITION_GROUP_BO=#{ew.entity.dispositionGroupBo}</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.displayType!=null"> AND DISPLAY_TYPE=#{ew.entity.displayType}</if>
                    <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
                    <if test="ew.entity.sendAsShared!=null"> AND SEND_AS_SHARED=#{ew.entity.sendAsShared}</if>
                    <if test="ew.entity.sentToErp!=null"> AND SENT_TO_ERP=#{ew.entity.sentToErp}</if>
                    <if test="ew.entity.erpChangeNumber!=null"> AND ERP_CHANGE_NUMBER=#{ew.entity.erpChangeNumber}</if>
                    <if test="ew.entity.relaxedFlow!=null"> AND RELAXED_FLOW=#{ew.entity.relaxedFlow}</if>
                    <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
                    <if test="ew.entity.origin!=null"> AND ORIGIN=#{ew.entity.origin}</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 ROUTER
        <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.router!=null"> AND ROUTER=#{ew.entity.router}</if>
                    <if test="ew.entity.routerType!=null"> AND ROUTER_TYPE=#{ew.entity.routerType}</if>
                    <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
                    <if test="ew.entity.temporaryRouter!=null"> AND TEMPORARY_ROUTER=#{ew.entity.temporaryRouter}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.entryRouterStepBo!=null"> AND ENTRY_ROUTER_STEP_BO=#{ew.entity.entryRouterStepBo}</if>
                    <if test="ew.entity.copiedFromRouterBo!=null"> AND COPIED_FROM_ROUTER_BO=#{ew.entity.copiedFromRouterBo}</if>
                    <if test="ew.entity.revision!=null"> AND REVISION=#{ew.entity.revision}</if>
                    <if test="ew.entity.currentRevision!=null"> AND CURRENT_REVISION=#{ew.entity.currentRevision}</if>
                    <if test="ew.entity.hasBeenReleased!=null"> AND HAS_BEEN_RELEASED=#{ew.entity.hasBeenReleased}</if>
                    <if test="ew.entity.effStartDate!=null"> AND EFF_START_DATE=#{ew.entity.effStartDate}</if>
                    <if test="ew.entity.effEndDate!=null"> AND EFF_END_DATE=#{ew.entity.effEndDate}</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.guiRepresentation!=null"> AND GUI_REPRESENTATION=#{ew.entity.guiRepresentation}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.dispositionGroupBo!=null"> AND DISPOSITION_GROUP_BO=#{ew.entity.dispositionGroupBo}</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.displayType!=null"> AND DISPLAY_TYPE=#{ew.entity.displayType}</if>
                    <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
                    <if test="ew.entity.sendAsShared!=null"> AND SEND_AS_SHARED=#{ew.entity.sendAsShared}</if>
                    <if test="ew.entity.sentToErp!=null"> AND SENT_TO_ERP=#{ew.entity.sentToErp}</if>
                    <if test="ew.entity.erpChangeNumber!=null"> AND ERP_CHANGE_NUMBER=#{ew.entity.erpChangeNumber}</if>
                    <if test="ew.entity.relaxedFlow!=null"> AND RELAXED_FLOW=#{ew.entity.relaxedFlow}</if>
                    <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
                    <if test="ew.entity.origin!=null"> AND ORIGIN=#{ew.entity.origin}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            ${ew.sqlSegment}
        </if>
    </select>

    <select id="selectMapsPage" resultType="HashMap">
        SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM ROUTER
        <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.router!=null"> AND ROUTER=#{ew.entity.router}</if>
                    <if test="ew.entity.routerType!=null"> AND ROUTER_TYPE=#{ew.entity.routerType}</if>
                    <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
                    <if test="ew.entity.temporaryRouter!=null"> AND TEMPORARY_ROUTER=#{ew.entity.temporaryRouter}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.entryRouterStepBo!=null"> AND ENTRY_ROUTER_STEP_BO=#{ew.entity.entryRouterStepBo}</if>
                    <if test="ew.entity.copiedFromRouterBo!=null"> AND COPIED_FROM_ROUTER_BO=#{ew.entity.copiedFromRouterBo}</if>
                    <if test="ew.entity.revision!=null"> AND REVISION=#{ew.entity.revision}</if>
                    <if test="ew.entity.currentRevision!=null"> AND CURRENT_REVISION=#{ew.entity.currentRevision}</if>
                    <if test="ew.entity.hasBeenReleased!=null"> AND HAS_BEEN_RELEASED=#{ew.entity.hasBeenReleased}</if>
                    <if test="ew.entity.effStartDate!=null"> AND EFF_START_DATE=#{ew.entity.effStartDate}</if>
                    <if test="ew.entity.effEndDate!=null"> AND EFF_END_DATE=#{ew.entity.effEndDate}</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.guiRepresentation!=null"> AND GUI_REPRESENTATION=#{ew.entity.guiRepresentation}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.dispositionGroupBo!=null"> AND DISPOSITION_GROUP_BO=#{ew.entity.dispositionGroupBo}</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.displayType!=null"> AND DISPLAY_TYPE=#{ew.entity.displayType}</if>
                    <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
                    <if test="ew.entity.sendAsShared!=null"> AND SEND_AS_SHARED=#{ew.entity.sendAsShared}</if>
                    <if test="ew.entity.sentToErp!=null"> AND SENT_TO_ERP=#{ew.entity.sentToErp}</if>
                    <if test="ew.entity.erpChangeNumber!=null"> AND ERP_CHANGE_NUMBER=#{ew.entity.erpChangeNumber}</if>
                    <if test="ew.entity.relaxedFlow!=null"> AND RELAXED_FLOW=#{ew.entity.relaxedFlow}</if>
                    <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
                    <if test="ew.entity.origin!=null"> AND ORIGIN=#{ew.entity.origin}</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.Router">
        INSERT INTO ROUTER
        <trim prefix="(" suffix=")" suffixOverrides=",">
            HANDLE,
            <if test="changeStamp!=null">CHANGE_STAMP,</if>
            <if test="site!=null">SITE,</if>
            <if test="router!=null">ROUTER,</if>
            <if test="routerType!=null">ROUTER_TYPE,</if>
            <if test="description!=null">DESCRIPTION,</if>
            <if test="temporaryRouter!=null">TEMPORARY_ROUTER,</if>
            <if test="statusBo!=null">STATUS_BO,</if>
            <if test="entryRouterStepBo!=null">ENTRY_ROUTER_STEP_BO,</if>
            <if test="copiedFromRouterBo!=null">COPIED_FROM_ROUTER_BO,</if>
            <if test="revision!=null">REVISION,</if>
            <if test="currentRevision!=null">CURRENT_REVISION,</if>
            <if test="hasBeenReleased!=null">HAS_BEEN_RELEASED,</if>
            <if test="effStartDate!=null">EFF_START_DATE,</if>
            <if test="effEndDate!=null">EFF_END_DATE,</if>
            <if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
            <if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
            <if test="guiRepresentation!=null">GUI_REPRESENTATION,</if>
            <if test="originalStatusBo!=null">ORIGINAL_STATUS_BO,</if>
            <if test="dispositionGroupBo!=null">DISPOSITION_GROUP_BO,</if>
            <if test="prevSite!=null">PREV_SITE,</if>
            <if test="originalTransferKey!=null">ORIGINAL_TRANSFER_KEY,</if>
            <if test="displayType!=null">DISPLAY_TYPE,</if>
            <if test="holdId!=null">HOLD_ID,</if>
            <if test="sendAsShared!=null">SEND_AS_SHARED,</if>
            <if test="sentToErp!=null">SENT_TO_ERP,</if>
            <if test="erpChangeNumber!=null">ERP_CHANGE_NUMBER,</if>
            <if test="relaxedFlow!=null">RELAXED_FLOW,</if>
            <if test="bomBo!=null">BOM_BO,</if>
            <if test="origin!=null">ORIGIN,</if>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            <if test="changeStamp!=null">#{changeStamp},</if>
            <if test="site!=null">#{site},</if>
            <if test="router!=null">#{router},</if>
            <if test="routerType!=null">#{routerType},</if>
            <if test="description!=null">#{description},</if>
            <if test="temporaryRouter!=null">#{temporaryRouter},</if>
            <if test="statusBo!=null">#{statusBo},</if>
            <if test="entryRouterStepBo!=null">#{entryRouterStepBo},</if>
            <if test="copiedFromRouterBo!=null">#{copiedFromRouterBo},</if>
            <if test="revision!=null">#{revision},</if>
            <if test="currentRevision!=null">#{currentRevision},</if>
            <if test="hasBeenReleased!=null">#{hasBeenReleased},</if>
            <if test="effStartDate!=null">#{effStartDate},</if>
            <if test="effEndDate!=null">#{effEndDate},</if>
            <if test="createdDateTime!=null">#{createdDateTime},</if>
            <if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
            <if test="guiRepresentation!=null">#{guiRepresentation},</if>
            <if test="originalStatusBo!=null">#{originalStatusBo},</if>
            <if test="dispositionGroupBo!=null">#{dispositionGroupBo},</if>
            <if test="prevSite!=null">#{prevSite},</if>
            <if test="originalTransferKey!=null">#{originalTransferKey},</if>
            <if test="displayType!=null">#{displayType},</if>
            <if test="holdId!=null">#{holdId},</if>
            <if test="sendAsShared!=null">#{sendAsShared},</if>
            <if test="sentToErp!=null">#{sentToErp},</if>
            <if test="erpChangeNumber!=null">#{erpChangeNumber},</if>
            <if test="relaxedFlow!=null">#{relaxedFlow},</if>
            <if test="bomBo!=null">#{bomBo},</if>
            <if test="origin!=null">#{origin},</if>
        </trim>
    </insert>

    <insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.meapi.model.Router">
        INSERT INTO ROUTER
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <include refid="Base_Column_List"></include>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            #{changeStamp},
            #{site},
            #{router},
            #{routerType},
            #{description},
            #{temporaryRouter},
            #{statusBo},
            #{entryRouterStepBo},
            #{copiedFromRouterBo},
            #{revision},
            #{currentRevision},
            #{hasBeenReleased},
            #{effStartDate},
            #{effEndDate},
            #{createdDateTime},
            #{modifiedDateTime},
            #{guiRepresentation},
            #{originalStatusBo},
            #{dispositionGroupBo},
            #{prevSite},
            #{originalTransferKey},
            #{displayType},
            #{holdId},
            #{sendAsShared},
            #{sentToErp},
            #{erpChangeNumber},
            #{relaxedFlow},
            #{bomBo},
            #{origin},
        </trim>
    </insert>






    <update id="update">
        UPDATE ROUTER <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.router!=null">ROUTER=#{et.router},</if>
        <if test="et.routerType!=null">ROUTER_TYPE=#{et.routerType},</if>
        <if test="et.description!=null">DESCRIPTION=#{et.description},</if>
        <if test="et.temporaryRouter!=null">TEMPORARY_ROUTER=#{et.temporaryRouter},</if>
        <if test="et.statusBo!=null">STATUS_BO=#{et.statusBo},</if>
        <if test="et.entryRouterStepBo!=null">ENTRY_ROUTER_STEP_BO=#{et.entryRouterStepBo},</if>
        <if test="et.copiedFromRouterBo!=null">COPIED_FROM_ROUTER_BO=#{et.copiedFromRouterBo},</if>
        <if test="et.revision!=null">REVISION=#{et.revision},</if>
        <if test="et.currentRevision!=null">CURRENT_REVISION=#{et.currentRevision},</if>
        <if test="et.hasBeenReleased!=null">HAS_BEEN_RELEASED=#{et.hasBeenReleased},</if>
        <if test="et.effStartDate!=null">EFF_START_DATE=#{et.effStartDate},</if>
        <if test="et.effEndDate!=null">EFF_END_DATE=#{et.effEndDate},</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.guiRepresentation!=null">GUI_REPRESENTATION=#{et.guiRepresentation},</if>
        <if test="et.originalStatusBo!=null">ORIGINAL_STATUS_BO=#{et.originalStatusBo},</if>
        <if test="et.dispositionGroupBo!=null">DISPOSITION_GROUP_BO=#{et.dispositionGroupBo},</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.displayType!=null">DISPLAY_TYPE=#{et.displayType},</if>
        <if test="et.holdId!=null">HOLD_ID=#{et.holdId},</if>
        <if test="et.sendAsShared!=null">SEND_AS_SHARED=#{et.sendAsShared},</if>
        <if test="et.sentToErp!=null">SENT_TO_ERP=#{et.sentToErp},</if>
        <if test="et.erpChangeNumber!=null">ERP_CHANGE_NUMBER=#{et.erpChangeNumber},</if>
        <if test="et.relaxedFlow!=null">RELAXED_FLOW=#{et.relaxedFlow},</if>
        <if test="et.bomBo!=null">BOM_BO=#{et.bomBo},</if>
        <if test="et.origin!=null">ORIGIN=#{et.origin},</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.router!=null"> AND ROUTER=#{ew.entity.router}</if>
                    <if test="ew.entity.routerType!=null"> AND ROUTER_TYPE=#{ew.entity.routerType}</if>
                    <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
                    <if test="ew.entity.temporaryRouter!=null"> AND TEMPORARY_ROUTER=#{ew.entity.temporaryRouter}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.entryRouterStepBo!=null"> AND ENTRY_ROUTER_STEP_BO=#{ew.entity.entryRouterStepBo}</if>
                    <if test="ew.entity.copiedFromRouterBo!=null"> AND COPIED_FROM_ROUTER_BO=#{ew.entity.copiedFromRouterBo}</if>
                    <if test="ew.entity.revision!=null"> AND REVISION=#{ew.entity.revision}</if>
                    <if test="ew.entity.currentRevision!=null"> AND CURRENT_REVISION=#{ew.entity.currentRevision}</if>
                    <if test="ew.entity.hasBeenReleased!=null"> AND HAS_BEEN_RELEASED=#{ew.entity.hasBeenReleased}</if>
                    <if test="ew.entity.effStartDate!=null"> AND EFF_START_DATE=#{ew.entity.effStartDate}</if>
                    <if test="ew.entity.effEndDate!=null"> AND EFF_END_DATE=#{ew.entity.effEndDate}</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.guiRepresentation!=null"> AND GUI_REPRESENTATION=#{ew.entity.guiRepresentation}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.dispositionGroupBo!=null"> AND DISPOSITION_GROUP_BO=#{ew.entity.dispositionGroupBo}</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.displayType!=null"> AND DISPLAY_TYPE=#{ew.entity.displayType}</if>
                    <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
                    <if test="ew.entity.sendAsShared!=null"> AND SEND_AS_SHARED=#{ew.entity.sendAsShared}</if>
                    <if test="ew.entity.sentToErp!=null"> AND SENT_TO_ERP=#{ew.entity.sentToErp}</if>
                    <if test="ew.entity.erpChangeNumber!=null"> AND ERP_CHANGE_NUMBER=#{ew.entity.erpChangeNumber}</if>
                    <if test="ew.entity.relaxedFlow!=null"> AND RELAXED_FLOW=#{ew.entity.relaxedFlow}</if>
                    <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
                    <if test="ew.entity.origin!=null"> AND ORIGIN=#{ew.entity.origin}</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 ROUTER
        <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 ROUTER
        <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.router!=null"> AND ROUTER=#{ew.entity.router}</if>
                    <if test="ew.entity.routerType!=null"> AND ROUTER_TYPE=#{ew.entity.routerType}</if>
                    <if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
                    <if test="ew.entity.temporaryRouter!=null"> AND TEMPORARY_ROUTER=#{ew.entity.temporaryRouter}</if>
                    <if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
                    <if test="ew.entity.entryRouterStepBo!=null"> AND ENTRY_ROUTER_STEP_BO=#{ew.entity.entryRouterStepBo}</if>
                    <if test="ew.entity.copiedFromRouterBo!=null"> AND COPIED_FROM_ROUTER_BO=#{ew.entity.copiedFromRouterBo}</if>
                    <if test="ew.entity.revision!=null"> AND REVISION=#{ew.entity.revision}</if>
                    <if test="ew.entity.currentRevision!=null"> AND CURRENT_REVISION=#{ew.entity.currentRevision}</if>
                    <if test="ew.entity.hasBeenReleased!=null"> AND HAS_BEEN_RELEASED=#{ew.entity.hasBeenReleased}</if>
                    <if test="ew.entity.effStartDate!=null"> AND EFF_START_DATE=#{ew.entity.effStartDate}</if>
                    <if test="ew.entity.effEndDate!=null"> AND EFF_END_DATE=#{ew.entity.effEndDate}</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.guiRepresentation!=null"> AND GUI_REPRESENTATION=#{ew.entity.guiRepresentation}</if>
                    <if test="ew.entity.originalStatusBo!=null"> AND ORIGINAL_STATUS_BO=#{ew.entity.originalStatusBo}</if>
                    <if test="ew.entity.dispositionGroupBo!=null"> AND DISPOSITION_GROUP_BO=#{ew.entity.dispositionGroupBo}</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.displayType!=null"> AND DISPLAY_TYPE=#{ew.entity.displayType}</if>
                    <if test="ew.entity.holdId!=null"> AND HOLD_ID=#{ew.entity.holdId}</if>
                    <if test="ew.entity.sendAsShared!=null"> AND SEND_AS_SHARED=#{ew.entity.sendAsShared}</if>
                    <if test="ew.entity.sentToErp!=null"> AND SENT_TO_ERP=#{ew.entity.sentToErp}</if>
                    <if test="ew.entity.erpChangeNumber!=null"> AND ERP_CHANGE_NUMBER=#{ew.entity.erpChangeNumber}</if>
                    <if test="ew.entity.relaxedFlow!=null"> AND RELAXED_FLOW=#{ew.entity.relaxedFlow}</if>
                    <if test="ew.entity.bomBo!=null"> AND BOM_BO=#{ew.entity.bomBo}</if>
                    <if test="ew.entity.origin!=null"> AND ORIGIN=#{ew.entity.origin}</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="selectRouterBySfcBo" resultType="com.foreverwin.mesnac.meapi.model.Router">
        SELECT R.HANDLE, R.SITE, R.ROUTER, R.ROUTER_TYPE, R.DESCRIPTION, R.TEMPORARY_ROUTER, R.STATUS_BO, R.ENTRY_ROUTER_STEP_BO, R.COPIED_FROM_ROUTER_BO, R.REVISION, R.CURRENT_REVISION, R.HAS_BEEN_RELEASED
        FROM SFC SC
        INNER JOIN SFC_ROUTING SG ON SG.SFC_BO = SC.HANDLE
        INNER JOIN SFC_ROUTER SR ON SR.SFC_ROUTING_BO = SG.HANDLE AND SR.IN_USE = 'true'
        INNER JOIN ROUTER R ON R.HANDLE = SR.ROUTER_BO
        WHERE SFC_BO = #{sfcBo}
    </select>

    <select id="selectRouterList4RevisionDesc" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include>
        FROM ROUTER
        WHERE SITE = #{site} AND ROUTER = #{router}
        ORDER BY TO_NUMBER(REVISION) DESC
    </select>
</mapper>
