<?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.anomaly.mapper.AbnormalBillLogMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.foreverwin.mesnac.anomaly.model.AbnormalBillLog">
        <id column="HANDLE" property="handle" />
        <result column="SITE" property="site" />
        <result column="ABNORMAL_NO" property="abnormalNo" />
        <result column="STATUS" property="status" />
        <result column="TYPE" property="type" />
        <result column="ITEM_BO" property="itemBo" />
        <result column="SFC" property="sfc" />
        <result column="OPERATION" property="operation" />
        <result column="WORK_CENTER" property="workCenter" />
        <result column="SHOP_ORDER" property="shopOrder" />
        <result column="MESSAGE_TYPE" property="messageType" />
        <result column="RESRCE" property="resrce" />
        <result column="NC_CODE" property="ncCode" />
        <result column="NC_CODE_GROUP" property="ncCodeGroup" />
        <result column="SHUT_DOWN" property="shutDown" />
        <result column="RESPONSE_USER" property="responseUser" />
        <result column="RESPONSE_DATE_TIME" property="responseDateTime" />
        <result column="PB_DESCRIPTION" property="pbDescription" />
        <result column="NC_QTY" property="ncQty" />
        <result column="PB_GRADE" property="pbGrade" />
        <result column="PB_USER" property="pbUser" />
        <result column="PB_QTY" property="pbQty" />
        <result column="REPAIR_DATE_TIME" property="repairDateTime" />
        <result column="DISCOVER" property="discover" />
        <result column="INSPECTOR" property="inspector" />
        <result column="ENTITY_LOCATION" property="entityLocation" />
        <result column="REPORT_FROM" property="reportFrom" />
        <result column="OBJECT_BO" property="objectBo" />
        <result column="PB_PHOTOSHOP" property="pbPhotoshop" />
        <result column="CANCEL_CODE" property="cancelCode" />
        <result column="CANCEL_REASON" property="cancelReason" />
        <result column="CANCEL_DATE_TIME" property="cancelDateTime" />
        <result column="CANCEL_USER" property="cancelUser" />
        <result column="DUTY_USER" property="dutyUser" />
        <result column="DUTY_DATE_TIME" property="dutyDateTime" />
        <result column="DUTY_DEPART" property="dutyDepart" />
        <result column="PRINCIPAL_USER" property="principalUser" />
        <result column="DUTY_CAUSE_DESCRIPTION" property="dutyCauseDescription" />
        <result column="DUTY_CAUSE_TYPE" property="dutyCauseType" />
        <result column="DUTY_TYPE" property="dutyType" />
        <result column="DUTY_SEND_USER_GROUP" property="dutySendUserGroup" />
        <result column="RESOLVE_USER" property="resolveUser" />
        <result column="RESOLVE_DATE_TIME" property="resolveDateTime" />
        <result column="ABNORMAL_METHOD" property="abnormalMethod" />
        <result column="ROUTER_BO" property="routerBo" />
        <result column="RESOLVE_SHOP_ORDER" property="resolveShopOrder" />
        <result column="RESOLVE_REMARK" property="resolveRemark" />
        <result column="RESOLVE_SEND_USER_GROUP" property="resolveSendUserGroup" />
        <result column="CLOSED_USER" property="closedUser" />
        <result column="CLOSED_DATE_TIME" property="closedDateTime" />
        <result column="ABNORMAL_REASON" property="abnormalReason" />
        <result column="BEFORE_MEASURE" property="beforeMeasure" />
        <result column="REPORT_SEND_USER_GROUP" property="reportSendUserGroup" />
        <result column="CANCEL_SEND_USER_GROUP" property="cancelSendUserGroup" />
        <result column="CREATED_USER" property="createdUser" />
        <result column="CREATED_DATA_TIME" property="createdDataTime" />
        <result column="MODIFIED_USER" property="modifiedUser" />
        <result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
        <result column="PRODUCT_CATEGORY" property="productCategory" />
        <result column="STEP_ID" property="stepId" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        HANDLE, SITE, ABNORMAL_NO, STATUS, TYPE, ITEM_BO, SFC, OPERATION, WORK_CENTER, SHOP_ORDER, MESSAGE_TYPE, RESRCE, NC_CODE, NC_CODE_GROUP, SHUT_DOWN, RESPONSE_USER, RESPONSE_DATE_TIME, PB_DESCRIPTION, NC_QTY, PB_GRADE, PB_USER, PB_QTY, REPAIR_DATE_TIME, DISCOVER, INSPECTOR, ENTITY_LOCATION, REPORT_FROM, OBJECT_BO, PB_PHOTOSHOP, CANCEL_CODE, CANCEL_REASON, CANCEL_DATE_TIME, CANCEL_USER, DUTY_USER, DUTY_DATE_TIME, DUTY_DEPART, PRINCIPAL_USER, DUTY_CAUSE_DESCRIPTION, DUTY_CAUSE_TYPE, DUTY_TYPE, DUTY_SEND_USER_GROUP, RESOLVE_USER, RESOLVE_DATE_TIME, ABNORMAL_METHOD, ROUTER_BO, RESOLVE_SHOP_ORDER, RESOLVE_REMARK, RESOLVE_SEND_USER_GROUP, CLOSED_USER, CLOSED_DATE_TIME, ABNORMAL_REASON, BEFORE_MEASURE, REPORT_SEND_USER_GROUP, CANCEL_SEND_USER_GROUP, CREATED_USER, CREATED_DATA_TIME, MODIFIED_USER, MODIFIED_DATE_TIME, PRODUCT_CATEGORY, STEP_ID
    </sql>

    <!-- BaseMapper标准查询/修改/删除 -->
    <select id="selectById" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include> FROM Z_ABNORMAL_BILL_LOG WHERE HANDLE=#{handle}
    </select>

    <select id="selectByMap" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include>
        FROM Z_ABNORMAL_BILL_LOG
        <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="selectBatchIds" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include>
        FROM Z_ABNORMAL_BILL_LOG WHERE HANDLE IN (
        <foreach item="item" index="index" collection="coll" separator=",">#{item}
        </foreach>)
    </select>

    <select id="selectOne" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include> FROM Z_ABNORMAL_BILL_LOG
        <where>
            <if test="ew.entity.handle!=null">
              HANDLE=#{ew.handle}
            </if>
            <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
            <if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
            <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
            <if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
            <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
            <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
            <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
            <if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
            <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
            <if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
            <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
            <if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
            <if test="ew.entity.ncCodeGroup!=null"> AND NC_CODE_GROUP=#{ew.entity.ncCodeGroup}</if>
            <if test="ew.entity.shutDown!=null"> AND SHUT_DOWN=#{ew.entity.shutDown}</if>
            <if test="ew.entity.responseUser!=null"> AND RESPONSE_USER=#{ew.entity.responseUser}</if>
            <if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
            <if test="ew.entity.pbDescription!=null"> AND PB_DESCRIPTION=#{ew.entity.pbDescription}</if>
            <if test="ew.entity.ncQty!=null"> AND NC_QTY=#{ew.entity.ncQty}</if>
            <if test="ew.entity.pbGrade!=null"> AND PB_GRADE=#{ew.entity.pbGrade}</if>
            <if test="ew.entity.pbUser!=null"> AND PB_USER=#{ew.entity.pbUser}</if>
            <if test="ew.entity.pbQty!=null"> AND PB_QTY=#{ew.entity.pbQty}</if>
            <if test="ew.entity.repairDateTime!=null"> AND REPAIR_DATE_TIME=#{ew.entity.repairDateTime}</if>
            <if test="ew.entity.discover!=null"> AND DISCOVER=#{ew.entity.discover}</if>
            <if test="ew.entity.inspector!=null"> AND INSPECTOR=#{ew.entity.inspector}</if>
            <if test="ew.entity.entityLocation!=null"> AND ENTITY_LOCATION=#{ew.entity.entityLocation}</if>
            <if test="ew.entity.reportFrom!=null"> AND REPORT_FROM=#{ew.entity.reportFrom}</if>
            <if test="ew.entity.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
            <if test="ew.entity.pbPhotoshop!=null"> AND PB_PHOTOSHOP=#{ew.entity.pbPhotoshop}</if>
            <if test="ew.entity.cancelCode!=null"> AND CANCEL_CODE=#{ew.entity.cancelCode}</if>
            <if test="ew.entity.cancelReason!=null"> AND CANCEL_REASON=#{ew.entity.cancelReason}</if>
            <if test="ew.entity.cancelDateTime!=null"> AND CANCEL_DATE_TIME=#{ew.entity.cancelDateTime}</if>
            <if test="ew.entity.cancelUser!=null"> AND CANCEL_USER=#{ew.entity.cancelUser}</if>
            <if test="ew.entity.dutyUser!=null"> AND DUTY_USER=#{ew.entity.dutyUser}</if>
            <if test="ew.entity.dutyDateTime!=null"> AND DUTY_DATE_TIME=#{ew.entity.dutyDateTime}</if>
            <if test="ew.entity.dutyDepart!=null"> AND DUTY_DEPART=#{ew.entity.dutyDepart}</if>
            <if test="ew.entity.principalUser!=null"> AND PRINCIPAL_USER=#{ew.entity.principalUser}</if>
            <if test="ew.entity.dutyCauseDescription!=null"> AND DUTY_CAUSE_DESCRIPTION=#{ew.entity.dutyCauseDescription}</if>
            <if test="ew.entity.dutyCauseType!=null"> AND DUTY_CAUSE_TYPE=#{ew.entity.dutyCauseType}</if>
            <if test="ew.entity.dutyType!=null"> AND DUTY_TYPE=#{ew.entity.dutyType}</if>
            <if test="ew.entity.dutySendUserGroup!=null"> AND DUTY_SEND_USER_GROUP=#{ew.entity.dutySendUserGroup}</if>
            <if test="ew.entity.resolveUser!=null"> AND RESOLVE_USER=#{ew.entity.resolveUser}</if>
            <if test="ew.entity.resolveDateTime!=null"> AND RESOLVE_DATE_TIME=#{ew.entity.resolveDateTime}</if>
            <if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
            <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
            <if test="ew.entity.resolveShopOrder!=null"> AND RESOLVE_SHOP_ORDER=#{ew.entity.resolveShopOrder}</if>
            <if test="ew.entity.resolveRemark!=null"> AND RESOLVE_REMARK=#{ew.entity.resolveRemark}</if>
            <if test="ew.entity.resolveSendUserGroup!=null"> AND RESOLVE_SEND_USER_GROUP=#{ew.entity.resolveSendUserGroup}</if>
            <if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
            <if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
            <if test="ew.entity.abnormalReason!=null"> AND ABNORMAL_REASON=#{ew.entity.abnormalReason}</if>
            <if test="ew.entity.beforeMeasure!=null"> AND BEFORE_MEASURE=#{ew.entity.beforeMeasure}</if>
            <if test="ew.entity.reportSendUserGroup!=null"> AND REPORT_SEND_USER_GROUP=#{ew.entity.reportSendUserGroup}</if>
            <if test="ew.entity.cancelSendUserGroup!=null"> AND CANCEL_SEND_USER_GROUP=#{ew.entity.cancelSendUserGroup}</if>
            <if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
            <if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
            <if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
            <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
            <if test="ew.entity.productCategory!=null"> AND PRODUCT_CATEGORY=#{ew.entity.productCategory}</if>
            <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
        </where>
    </select>

    <select id="selectCount" resultType="Integer">
        SELECT COUNT(1) FROM Z_ABNORMAL_BILL_LOG
        <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.site!=null"> AND SITE=#{ew.entity.site}</if>
                <if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
                <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
                <if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
                <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
                <if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
                <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                <if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
                <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
                <if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
                <if test="ew.entity.ncCodeGroup!=null"> AND NC_CODE_GROUP=#{ew.entity.ncCodeGroup}</if>
                <if test="ew.entity.shutDown!=null"> AND SHUT_DOWN=#{ew.entity.shutDown}</if>
                <if test="ew.entity.responseUser!=null"> AND RESPONSE_USER=#{ew.entity.responseUser}</if>
                <if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
                <if test="ew.entity.pbDescription!=null"> AND PB_DESCRIPTION=#{ew.entity.pbDescription}</if>
                <if test="ew.entity.ncQty!=null"> AND NC_QTY=#{ew.entity.ncQty}</if>
                <if test="ew.entity.pbGrade!=null"> AND PB_GRADE=#{ew.entity.pbGrade}</if>
                <if test="ew.entity.pbUser!=null"> AND PB_USER=#{ew.entity.pbUser}</if>
                <if test="ew.entity.pbQty!=null"> AND PB_QTY=#{ew.entity.pbQty}</if>
                <if test="ew.entity.repairDateTime!=null"> AND REPAIR_DATE_TIME=#{ew.entity.repairDateTime}</if>
                <if test="ew.entity.discover!=null"> AND DISCOVER=#{ew.entity.discover}</if>
                <if test="ew.entity.inspector!=null"> AND INSPECTOR=#{ew.entity.inspector}</if>
                <if test="ew.entity.entityLocation!=null"> AND ENTITY_LOCATION=#{ew.entity.entityLocation}</if>
                <if test="ew.entity.reportFrom!=null"> AND REPORT_FROM=#{ew.entity.reportFrom}</if>
                <if test="ew.entity.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
                <if test="ew.entity.pbPhotoshop!=null"> AND PB_PHOTOSHOP=#{ew.entity.pbPhotoshop}</if>
                <if test="ew.entity.cancelCode!=null"> AND CANCEL_CODE=#{ew.entity.cancelCode}</if>
                <if test="ew.entity.cancelReason!=null"> AND CANCEL_REASON=#{ew.entity.cancelReason}</if>
                <if test="ew.entity.cancelDateTime!=null"> AND CANCEL_DATE_TIME=#{ew.entity.cancelDateTime}</if>
                <if test="ew.entity.cancelUser!=null"> AND CANCEL_USER=#{ew.entity.cancelUser}</if>
                <if test="ew.entity.dutyUser!=null"> AND DUTY_USER=#{ew.entity.dutyUser}</if>
                <if test="ew.entity.dutyDateTime!=null"> AND DUTY_DATE_TIME=#{ew.entity.dutyDateTime}</if>
                <if test="ew.entity.dutyDepart!=null"> AND DUTY_DEPART=#{ew.entity.dutyDepart}</if>
                <if test="ew.entity.principalUser!=null"> AND PRINCIPAL_USER=#{ew.entity.principalUser}</if>
                <if test="ew.entity.dutyCauseDescription!=null"> AND DUTY_CAUSE_DESCRIPTION=#{ew.entity.dutyCauseDescription}</if>
                <if test="ew.entity.dutyCauseType!=null"> AND DUTY_CAUSE_TYPE=#{ew.entity.dutyCauseType}</if>
                <if test="ew.entity.dutyType!=null"> AND DUTY_TYPE=#{ew.entity.dutyType}</if>
                <if test="ew.entity.dutySendUserGroup!=null"> AND DUTY_SEND_USER_GROUP=#{ew.entity.dutySendUserGroup}</if>
                <if test="ew.entity.resolveUser!=null"> AND RESOLVE_USER=#{ew.entity.resolveUser}</if>
                <if test="ew.entity.resolveDateTime!=null"> AND RESOLVE_DATE_TIME=#{ew.entity.resolveDateTime}</if>
                <if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
                <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
                <if test="ew.entity.resolveShopOrder!=null"> AND RESOLVE_SHOP_ORDER=#{ew.entity.resolveShopOrder}</if>
                <if test="ew.entity.resolveRemark!=null"> AND RESOLVE_REMARK=#{ew.entity.resolveRemark}</if>
                <if test="ew.entity.resolveSendUserGroup!=null"> AND RESOLVE_SEND_USER_GROUP=#{ew.entity.resolveSendUserGroup}</if>
                <if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
                <if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
                <if test="ew.entity.abnormalReason!=null"> AND ABNORMAL_REASON=#{ew.entity.abnormalReason}</if>
                <if test="ew.entity.beforeMeasure!=null"> AND BEFORE_MEASURE=#{ew.entity.beforeMeasure}</if>
                <if test="ew.entity.reportSendUserGroup!=null"> AND REPORT_SEND_USER_GROUP=#{ew.entity.reportSendUserGroup}</if>
                <if test="ew.entity.cancelSendUserGroup!=null"> AND CANCEL_SEND_USER_GROUP=#{ew.entity.cancelSendUserGroup}</if>
                <if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
                <if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
                <if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
                <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                <if test="ew.entity.productCategory!=null"> AND PRODUCT_CATEGORY=#{ew.entity.productCategory}</if>
                <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</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 Z_ABNORMAL_BILL_LOG
        <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.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
                    <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
                    <if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
                    <if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
                    <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
                    <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
                    <if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
                    <if test="ew.entity.ncCodeGroup!=null"> AND NC_CODE_GROUP=#{ew.entity.ncCodeGroup}</if>
                    <if test="ew.entity.shutDown!=null"> AND SHUT_DOWN=#{ew.entity.shutDown}</if>
                    <if test="ew.entity.responseUser!=null"> AND RESPONSE_USER=#{ew.entity.responseUser}</if>
                    <if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
                    <if test="ew.entity.pbDescription!=null"> AND PB_DESCRIPTION=#{ew.entity.pbDescription}</if>
                    <if test="ew.entity.ncQty!=null"> AND NC_QTY=#{ew.entity.ncQty}</if>
                    <if test="ew.entity.pbGrade!=null"> AND PB_GRADE=#{ew.entity.pbGrade}</if>
                    <if test="ew.entity.pbUser!=null"> AND PB_USER=#{ew.entity.pbUser}</if>
                    <if test="ew.entity.pbQty!=null"> AND PB_QTY=#{ew.entity.pbQty}</if>
                    <if test="ew.entity.repairDateTime!=null"> AND REPAIR_DATE_TIME=#{ew.entity.repairDateTime}</if>
                    <if test="ew.entity.discover!=null"> AND DISCOVER=#{ew.entity.discover}</if>
                    <if test="ew.entity.inspector!=null"> AND INSPECTOR=#{ew.entity.inspector}</if>
                    <if test="ew.entity.entityLocation!=null"> AND ENTITY_LOCATION=#{ew.entity.entityLocation}</if>
                    <if test="ew.entity.reportFrom!=null"> AND REPORT_FROM=#{ew.entity.reportFrom}</if>
                    <if test="ew.entity.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
                    <if test="ew.entity.pbPhotoshop!=null"> AND PB_PHOTOSHOP=#{ew.entity.pbPhotoshop}</if>
                    <if test="ew.entity.cancelCode!=null"> AND CANCEL_CODE=#{ew.entity.cancelCode}</if>
                    <if test="ew.entity.cancelReason!=null"> AND CANCEL_REASON=#{ew.entity.cancelReason}</if>
                    <if test="ew.entity.cancelDateTime!=null"> AND CANCEL_DATE_TIME=#{ew.entity.cancelDateTime}</if>
                    <if test="ew.entity.cancelUser!=null"> AND CANCEL_USER=#{ew.entity.cancelUser}</if>
                    <if test="ew.entity.dutyUser!=null"> AND DUTY_USER=#{ew.entity.dutyUser}</if>
                    <if test="ew.entity.dutyDateTime!=null"> AND DUTY_DATE_TIME=#{ew.entity.dutyDateTime}</if>
                    <if test="ew.entity.dutyDepart!=null"> AND DUTY_DEPART=#{ew.entity.dutyDepart}</if>
                    <if test="ew.entity.principalUser!=null"> AND PRINCIPAL_USER=#{ew.entity.principalUser}</if>
                    <if test="ew.entity.dutyCauseDescription!=null"> AND DUTY_CAUSE_DESCRIPTION=#{ew.entity.dutyCauseDescription}</if>
                    <if test="ew.entity.dutyCauseType!=null"> AND DUTY_CAUSE_TYPE=#{ew.entity.dutyCauseType}</if>
                    <if test="ew.entity.dutyType!=null"> AND DUTY_TYPE=#{ew.entity.dutyType}</if>
                    <if test="ew.entity.dutySendUserGroup!=null"> AND DUTY_SEND_USER_GROUP=#{ew.entity.dutySendUserGroup}</if>
                    <if test="ew.entity.resolveUser!=null"> AND RESOLVE_USER=#{ew.entity.resolveUser}</if>
                    <if test="ew.entity.resolveDateTime!=null"> AND RESOLVE_DATE_TIME=#{ew.entity.resolveDateTime}</if>
                    <if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
                    <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
                    <if test="ew.entity.resolveShopOrder!=null"> AND RESOLVE_SHOP_ORDER=#{ew.entity.resolveShopOrder}</if>
                    <if test="ew.entity.resolveRemark!=null"> AND RESOLVE_REMARK=#{ew.entity.resolveRemark}</if>
                    <if test="ew.entity.resolveSendUserGroup!=null"> AND RESOLVE_SEND_USER_GROUP=#{ew.entity.resolveSendUserGroup}</if>
                    <if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
                    <if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
                    <if test="ew.entity.abnormalReason!=null"> AND ABNORMAL_REASON=#{ew.entity.abnormalReason}</if>
                    <if test="ew.entity.beforeMeasure!=null"> AND BEFORE_MEASURE=#{ew.entity.beforeMeasure}</if>
                    <if test="ew.entity.reportSendUserGroup!=null"> AND REPORT_SEND_USER_GROUP=#{ew.entity.reportSendUserGroup}</if>
                    <if test="ew.entity.cancelSendUserGroup!=null"> AND CANCEL_SEND_USER_GROUP=#{ew.entity.cancelSendUserGroup}</if>
                    <if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
                    <if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
                    <if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.productCategory!=null"> AND PRODUCT_CATEGORY=#{ew.entity.productCategory}</if>
                    <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</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 Z_ABNORMAL_BILL_LOG
        <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.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
                    <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
                    <if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
                    <if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
                    <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
                    <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
                    <if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
                    <if test="ew.entity.ncCodeGroup!=null"> AND NC_CODE_GROUP=#{ew.entity.ncCodeGroup}</if>
                    <if test="ew.entity.shutDown!=null"> AND SHUT_DOWN=#{ew.entity.shutDown}</if>
                    <if test="ew.entity.responseUser!=null"> AND RESPONSE_USER=#{ew.entity.responseUser}</if>
                    <if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
                    <if test="ew.entity.pbDescription!=null"> AND PB_DESCRIPTION=#{ew.entity.pbDescription}</if>
                    <if test="ew.entity.ncQty!=null"> AND NC_QTY=#{ew.entity.ncQty}</if>
                    <if test="ew.entity.pbGrade!=null"> AND PB_GRADE=#{ew.entity.pbGrade}</if>
                    <if test="ew.entity.pbUser!=null"> AND PB_USER=#{ew.entity.pbUser}</if>
                    <if test="ew.entity.pbQty!=null"> AND PB_QTY=#{ew.entity.pbQty}</if>
                    <if test="ew.entity.repairDateTime!=null"> AND REPAIR_DATE_TIME=#{ew.entity.repairDateTime}</if>
                    <if test="ew.entity.discover!=null"> AND DISCOVER=#{ew.entity.discover}</if>
                    <if test="ew.entity.inspector!=null"> AND INSPECTOR=#{ew.entity.inspector}</if>
                    <if test="ew.entity.entityLocation!=null"> AND ENTITY_LOCATION=#{ew.entity.entityLocation}</if>
                    <if test="ew.entity.reportFrom!=null"> AND REPORT_FROM=#{ew.entity.reportFrom}</if>
                    <if test="ew.entity.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
                    <if test="ew.entity.pbPhotoshop!=null"> AND PB_PHOTOSHOP=#{ew.entity.pbPhotoshop}</if>
                    <if test="ew.entity.cancelCode!=null"> AND CANCEL_CODE=#{ew.entity.cancelCode}</if>
                    <if test="ew.entity.cancelReason!=null"> AND CANCEL_REASON=#{ew.entity.cancelReason}</if>
                    <if test="ew.entity.cancelDateTime!=null"> AND CANCEL_DATE_TIME=#{ew.entity.cancelDateTime}</if>
                    <if test="ew.entity.cancelUser!=null"> AND CANCEL_USER=#{ew.entity.cancelUser}</if>
                    <if test="ew.entity.dutyUser!=null"> AND DUTY_USER=#{ew.entity.dutyUser}</if>
                    <if test="ew.entity.dutyDateTime!=null"> AND DUTY_DATE_TIME=#{ew.entity.dutyDateTime}</if>
                    <if test="ew.entity.dutyDepart!=null"> AND DUTY_DEPART=#{ew.entity.dutyDepart}</if>
                    <if test="ew.entity.principalUser!=null"> AND PRINCIPAL_USER=#{ew.entity.principalUser}</if>
                    <if test="ew.entity.dutyCauseDescription!=null"> AND DUTY_CAUSE_DESCRIPTION=#{ew.entity.dutyCauseDescription}</if>
                    <if test="ew.entity.dutyCauseType!=null"> AND DUTY_CAUSE_TYPE=#{ew.entity.dutyCauseType}</if>
                    <if test="ew.entity.dutyType!=null"> AND DUTY_TYPE=#{ew.entity.dutyType}</if>
                    <if test="ew.entity.dutySendUserGroup!=null"> AND DUTY_SEND_USER_GROUP=#{ew.entity.dutySendUserGroup}</if>
                    <if test="ew.entity.resolveUser!=null"> AND RESOLVE_USER=#{ew.entity.resolveUser}</if>
                    <if test="ew.entity.resolveDateTime!=null"> AND RESOLVE_DATE_TIME=#{ew.entity.resolveDateTime}</if>
                    <if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
                    <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
                    <if test="ew.entity.resolveShopOrder!=null"> AND RESOLVE_SHOP_ORDER=#{ew.entity.resolveShopOrder}</if>
                    <if test="ew.entity.resolveRemark!=null"> AND RESOLVE_REMARK=#{ew.entity.resolveRemark}</if>
                    <if test="ew.entity.resolveSendUserGroup!=null"> AND RESOLVE_SEND_USER_GROUP=#{ew.entity.resolveSendUserGroup}</if>
                    <if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
                    <if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
                    <if test="ew.entity.abnormalReason!=null"> AND ABNORMAL_REASON=#{ew.entity.abnormalReason}</if>
                    <if test="ew.entity.beforeMeasure!=null"> AND BEFORE_MEASURE=#{ew.entity.beforeMeasure}</if>
                    <if test="ew.entity.reportSendUserGroup!=null"> AND REPORT_SEND_USER_GROUP=#{ew.entity.reportSendUserGroup}</if>
                    <if test="ew.entity.cancelSendUserGroup!=null"> AND CANCEL_SEND_USER_GROUP=#{ew.entity.cancelSendUserGroup}</if>
                    <if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
                    <if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
                    <if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.productCategory!=null"> AND PRODUCT_CATEGORY=#{ew.entity.productCategory}</if>
                    <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</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 Z_ABNORMAL_BILL_LOG
        <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.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
                    <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
                    <if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
                    <if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
                    <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
                    <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
                    <if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
                    <if test="ew.entity.ncCodeGroup!=null"> AND NC_CODE_GROUP=#{ew.entity.ncCodeGroup}</if>
                    <if test="ew.entity.shutDown!=null"> AND SHUT_DOWN=#{ew.entity.shutDown}</if>
                    <if test="ew.entity.responseUser!=null"> AND RESPONSE_USER=#{ew.entity.responseUser}</if>
                    <if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
                    <if test="ew.entity.pbDescription!=null"> AND PB_DESCRIPTION=#{ew.entity.pbDescription}</if>
                    <if test="ew.entity.ncQty!=null"> AND NC_QTY=#{ew.entity.ncQty}</if>
                    <if test="ew.entity.pbGrade!=null"> AND PB_GRADE=#{ew.entity.pbGrade}</if>
                    <if test="ew.entity.pbUser!=null"> AND PB_USER=#{ew.entity.pbUser}</if>
                    <if test="ew.entity.pbQty!=null"> AND PB_QTY=#{ew.entity.pbQty}</if>
                    <if test="ew.entity.repairDateTime!=null"> AND REPAIR_DATE_TIME=#{ew.entity.repairDateTime}</if>
                    <if test="ew.entity.discover!=null"> AND DISCOVER=#{ew.entity.discover}</if>
                    <if test="ew.entity.inspector!=null"> AND INSPECTOR=#{ew.entity.inspector}</if>
                    <if test="ew.entity.entityLocation!=null"> AND ENTITY_LOCATION=#{ew.entity.entityLocation}</if>
                    <if test="ew.entity.reportFrom!=null"> AND REPORT_FROM=#{ew.entity.reportFrom}</if>
                    <if test="ew.entity.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
                    <if test="ew.entity.pbPhotoshop!=null"> AND PB_PHOTOSHOP=#{ew.entity.pbPhotoshop}</if>
                    <if test="ew.entity.cancelCode!=null"> AND CANCEL_CODE=#{ew.entity.cancelCode}</if>
                    <if test="ew.entity.cancelReason!=null"> AND CANCEL_REASON=#{ew.entity.cancelReason}</if>
                    <if test="ew.entity.cancelDateTime!=null"> AND CANCEL_DATE_TIME=#{ew.entity.cancelDateTime}</if>
                    <if test="ew.entity.cancelUser!=null"> AND CANCEL_USER=#{ew.entity.cancelUser}</if>
                    <if test="ew.entity.dutyUser!=null"> AND DUTY_USER=#{ew.entity.dutyUser}</if>
                    <if test="ew.entity.dutyDateTime!=null"> AND DUTY_DATE_TIME=#{ew.entity.dutyDateTime}</if>
                    <if test="ew.entity.dutyDepart!=null"> AND DUTY_DEPART=#{ew.entity.dutyDepart}</if>
                    <if test="ew.entity.principalUser!=null"> AND PRINCIPAL_USER=#{ew.entity.principalUser}</if>
                    <if test="ew.entity.dutyCauseDescription!=null"> AND DUTY_CAUSE_DESCRIPTION=#{ew.entity.dutyCauseDescription}</if>
                    <if test="ew.entity.dutyCauseType!=null"> AND DUTY_CAUSE_TYPE=#{ew.entity.dutyCauseType}</if>
                    <if test="ew.entity.dutyType!=null"> AND DUTY_TYPE=#{ew.entity.dutyType}</if>
                    <if test="ew.entity.dutySendUserGroup!=null"> AND DUTY_SEND_USER_GROUP=#{ew.entity.dutySendUserGroup}</if>
                    <if test="ew.entity.resolveUser!=null"> AND RESOLVE_USER=#{ew.entity.resolveUser}</if>
                    <if test="ew.entity.resolveDateTime!=null"> AND RESOLVE_DATE_TIME=#{ew.entity.resolveDateTime}</if>
                    <if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
                    <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
                    <if test="ew.entity.resolveShopOrder!=null"> AND RESOLVE_SHOP_ORDER=#{ew.entity.resolveShopOrder}</if>
                    <if test="ew.entity.resolveRemark!=null"> AND RESOLVE_REMARK=#{ew.entity.resolveRemark}</if>
                    <if test="ew.entity.resolveSendUserGroup!=null"> AND RESOLVE_SEND_USER_GROUP=#{ew.entity.resolveSendUserGroup}</if>
                    <if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
                    <if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
                    <if test="ew.entity.abnormalReason!=null"> AND ABNORMAL_REASON=#{ew.entity.abnormalReason}</if>
                    <if test="ew.entity.beforeMeasure!=null"> AND BEFORE_MEASURE=#{ew.entity.beforeMeasure}</if>
                    <if test="ew.entity.reportSendUserGroup!=null"> AND REPORT_SEND_USER_GROUP=#{ew.entity.reportSendUserGroup}</if>
                    <if test="ew.entity.cancelSendUserGroup!=null"> AND CANCEL_SEND_USER_GROUP=#{ew.entity.cancelSendUserGroup}</if>
                    <if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
                    <if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
                    <if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.productCategory!=null"> AND PRODUCT_CATEGORY=#{ew.entity.productCategory}</if>
                    <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</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 Z_ABNORMAL_BILL_LOG
        <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.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
                    <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
                    <if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
                    <if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
                    <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
                    <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
                    <if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
                    <if test="ew.entity.ncCodeGroup!=null"> AND NC_CODE_GROUP=#{ew.entity.ncCodeGroup}</if>
                    <if test="ew.entity.shutDown!=null"> AND SHUT_DOWN=#{ew.entity.shutDown}</if>
                    <if test="ew.entity.responseUser!=null"> AND RESPONSE_USER=#{ew.entity.responseUser}</if>
                    <if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
                    <if test="ew.entity.pbDescription!=null"> AND PB_DESCRIPTION=#{ew.entity.pbDescription}</if>
                    <if test="ew.entity.ncQty!=null"> AND NC_QTY=#{ew.entity.ncQty}</if>
                    <if test="ew.entity.pbGrade!=null"> AND PB_GRADE=#{ew.entity.pbGrade}</if>
                    <if test="ew.entity.pbUser!=null"> AND PB_USER=#{ew.entity.pbUser}</if>
                    <if test="ew.entity.pbQty!=null"> AND PB_QTY=#{ew.entity.pbQty}</if>
                    <if test="ew.entity.repairDateTime!=null"> AND REPAIR_DATE_TIME=#{ew.entity.repairDateTime}</if>
                    <if test="ew.entity.discover!=null"> AND DISCOVER=#{ew.entity.discover}</if>
                    <if test="ew.entity.inspector!=null"> AND INSPECTOR=#{ew.entity.inspector}</if>
                    <if test="ew.entity.entityLocation!=null"> AND ENTITY_LOCATION=#{ew.entity.entityLocation}</if>
                    <if test="ew.entity.reportFrom!=null"> AND REPORT_FROM=#{ew.entity.reportFrom}</if>
                    <if test="ew.entity.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
                    <if test="ew.entity.pbPhotoshop!=null"> AND PB_PHOTOSHOP=#{ew.entity.pbPhotoshop}</if>
                    <if test="ew.entity.cancelCode!=null"> AND CANCEL_CODE=#{ew.entity.cancelCode}</if>
                    <if test="ew.entity.cancelReason!=null"> AND CANCEL_REASON=#{ew.entity.cancelReason}</if>
                    <if test="ew.entity.cancelDateTime!=null"> AND CANCEL_DATE_TIME=#{ew.entity.cancelDateTime}</if>
                    <if test="ew.entity.cancelUser!=null"> AND CANCEL_USER=#{ew.entity.cancelUser}</if>
                    <if test="ew.entity.dutyUser!=null"> AND DUTY_USER=#{ew.entity.dutyUser}</if>
                    <if test="ew.entity.dutyDateTime!=null"> AND DUTY_DATE_TIME=#{ew.entity.dutyDateTime}</if>
                    <if test="ew.entity.dutyDepart!=null"> AND DUTY_DEPART=#{ew.entity.dutyDepart}</if>
                    <if test="ew.entity.principalUser!=null"> AND PRINCIPAL_USER=#{ew.entity.principalUser}</if>
                    <if test="ew.entity.dutyCauseDescription!=null"> AND DUTY_CAUSE_DESCRIPTION=#{ew.entity.dutyCauseDescription}</if>
                    <if test="ew.entity.dutyCauseType!=null"> AND DUTY_CAUSE_TYPE=#{ew.entity.dutyCauseType}</if>
                    <if test="ew.entity.dutyType!=null"> AND DUTY_TYPE=#{ew.entity.dutyType}</if>
                    <if test="ew.entity.dutySendUserGroup!=null"> AND DUTY_SEND_USER_GROUP=#{ew.entity.dutySendUserGroup}</if>
                    <if test="ew.entity.resolveUser!=null"> AND RESOLVE_USER=#{ew.entity.resolveUser}</if>
                    <if test="ew.entity.resolveDateTime!=null"> AND RESOLVE_DATE_TIME=#{ew.entity.resolveDateTime}</if>
                    <if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
                    <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
                    <if test="ew.entity.resolveShopOrder!=null"> AND RESOLVE_SHOP_ORDER=#{ew.entity.resolveShopOrder}</if>
                    <if test="ew.entity.resolveRemark!=null"> AND RESOLVE_REMARK=#{ew.entity.resolveRemark}</if>
                    <if test="ew.entity.resolveSendUserGroup!=null"> AND RESOLVE_SEND_USER_GROUP=#{ew.entity.resolveSendUserGroup}</if>
                    <if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
                    <if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
                    <if test="ew.entity.abnormalReason!=null"> AND ABNORMAL_REASON=#{ew.entity.abnormalReason}</if>
                    <if test="ew.entity.beforeMeasure!=null"> AND BEFORE_MEASURE=#{ew.entity.beforeMeasure}</if>
                    <if test="ew.entity.reportSendUserGroup!=null"> AND REPORT_SEND_USER_GROUP=#{ew.entity.reportSendUserGroup}</if>
                    <if test="ew.entity.cancelSendUserGroup!=null"> AND CANCEL_SEND_USER_GROUP=#{ew.entity.cancelSendUserGroup}</if>
                    <if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
                    <if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
                    <if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.productCategory!=null"> AND PRODUCT_CATEGORY=#{ew.entity.productCategory}</if>
                    <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</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 Z_ABNORMAL_BILL_LOG
        <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.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
                    <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
                    <if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
                    <if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
                    <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
                    <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
                    <if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
                    <if test="ew.entity.ncCodeGroup!=null"> AND NC_CODE_GROUP=#{ew.entity.ncCodeGroup}</if>
                    <if test="ew.entity.shutDown!=null"> AND SHUT_DOWN=#{ew.entity.shutDown}</if>
                    <if test="ew.entity.responseUser!=null"> AND RESPONSE_USER=#{ew.entity.responseUser}</if>
                    <if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
                    <if test="ew.entity.pbDescription!=null"> AND PB_DESCRIPTION=#{ew.entity.pbDescription}</if>
                    <if test="ew.entity.ncQty!=null"> AND NC_QTY=#{ew.entity.ncQty}</if>
                    <if test="ew.entity.pbGrade!=null"> AND PB_GRADE=#{ew.entity.pbGrade}</if>
                    <if test="ew.entity.pbUser!=null"> AND PB_USER=#{ew.entity.pbUser}</if>
                    <if test="ew.entity.pbQty!=null"> AND PB_QTY=#{ew.entity.pbQty}</if>
                    <if test="ew.entity.repairDateTime!=null"> AND REPAIR_DATE_TIME=#{ew.entity.repairDateTime}</if>
                    <if test="ew.entity.discover!=null"> AND DISCOVER=#{ew.entity.discover}</if>
                    <if test="ew.entity.inspector!=null"> AND INSPECTOR=#{ew.entity.inspector}</if>
                    <if test="ew.entity.entityLocation!=null"> AND ENTITY_LOCATION=#{ew.entity.entityLocation}</if>
                    <if test="ew.entity.reportFrom!=null"> AND REPORT_FROM=#{ew.entity.reportFrom}</if>
                    <if test="ew.entity.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
                    <if test="ew.entity.pbPhotoshop!=null"> AND PB_PHOTOSHOP=#{ew.entity.pbPhotoshop}</if>
                    <if test="ew.entity.cancelCode!=null"> AND CANCEL_CODE=#{ew.entity.cancelCode}</if>
                    <if test="ew.entity.cancelReason!=null"> AND CANCEL_REASON=#{ew.entity.cancelReason}</if>
                    <if test="ew.entity.cancelDateTime!=null"> AND CANCEL_DATE_TIME=#{ew.entity.cancelDateTime}</if>
                    <if test="ew.entity.cancelUser!=null"> AND CANCEL_USER=#{ew.entity.cancelUser}</if>
                    <if test="ew.entity.dutyUser!=null"> AND DUTY_USER=#{ew.entity.dutyUser}</if>
                    <if test="ew.entity.dutyDateTime!=null"> AND DUTY_DATE_TIME=#{ew.entity.dutyDateTime}</if>
                    <if test="ew.entity.dutyDepart!=null"> AND DUTY_DEPART=#{ew.entity.dutyDepart}</if>
                    <if test="ew.entity.principalUser!=null"> AND PRINCIPAL_USER=#{ew.entity.principalUser}</if>
                    <if test="ew.entity.dutyCauseDescription!=null"> AND DUTY_CAUSE_DESCRIPTION=#{ew.entity.dutyCauseDescription}</if>
                    <if test="ew.entity.dutyCauseType!=null"> AND DUTY_CAUSE_TYPE=#{ew.entity.dutyCauseType}</if>
                    <if test="ew.entity.dutyType!=null"> AND DUTY_TYPE=#{ew.entity.dutyType}</if>
                    <if test="ew.entity.dutySendUserGroup!=null"> AND DUTY_SEND_USER_GROUP=#{ew.entity.dutySendUserGroup}</if>
                    <if test="ew.entity.resolveUser!=null"> AND RESOLVE_USER=#{ew.entity.resolveUser}</if>
                    <if test="ew.entity.resolveDateTime!=null"> AND RESOLVE_DATE_TIME=#{ew.entity.resolveDateTime}</if>
                    <if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
                    <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
                    <if test="ew.entity.resolveShopOrder!=null"> AND RESOLVE_SHOP_ORDER=#{ew.entity.resolveShopOrder}</if>
                    <if test="ew.entity.resolveRemark!=null"> AND RESOLVE_REMARK=#{ew.entity.resolveRemark}</if>
                    <if test="ew.entity.resolveSendUserGroup!=null"> AND RESOLVE_SEND_USER_GROUP=#{ew.entity.resolveSendUserGroup}</if>
                    <if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
                    <if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
                    <if test="ew.entity.abnormalReason!=null"> AND ABNORMAL_REASON=#{ew.entity.abnormalReason}</if>
                    <if test="ew.entity.beforeMeasure!=null"> AND BEFORE_MEASURE=#{ew.entity.beforeMeasure}</if>
                    <if test="ew.entity.reportSendUserGroup!=null"> AND REPORT_SEND_USER_GROUP=#{ew.entity.reportSendUserGroup}</if>
                    <if test="ew.entity.cancelSendUserGroup!=null"> AND CANCEL_SEND_USER_GROUP=#{ew.entity.cancelSendUserGroup}</if>
                    <if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
                    <if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
                    <if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.productCategory!=null"> AND PRODUCT_CATEGORY=#{ew.entity.productCategory}</if>
                    <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</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.anomaly.model.AbnormalBillLog">
        INSERT INTO Z_ABNORMAL_BILL_LOG
        <trim prefix="(" suffix=")" suffixOverrides=",">
            HANDLE,
            <if test="site!=null">SITE,</if>
            <if test="abnormalNo!=null">ABNORMAL_NO,</if>
            <if test="status!=null">STATUS,</if>
            <if test="type!=null">TYPE,</if>
            <if test="itemBo!=null">ITEM_BO,</if>
            <if test="sfc!=null">SFC,</if>
            <if test="operation!=null">OPERATION,</if>
            <if test="workCenter!=null">WORK_CENTER,</if>
            <if test="shopOrder!=null">SHOP_ORDER,</if>
            <if test="messageType!=null">MESSAGE_TYPE,</if>
            <if test="resrce!=null">RESRCE,</if>
            <if test="ncCode!=null">NC_CODE,</if>
            <if test="ncCodeGroup!=null">NC_CODE_GROUP,</if>
            <if test="shutDown!=null">SHUT_DOWN,</if>
            <if test="responseUser!=null">RESPONSE_USER,</if>
            <if test="responseDateTime!=null">RESPONSE_DATE_TIME,</if>
            <if test="pbDescription!=null">PB_DESCRIPTION,</if>
            <if test="ncQty!=null">NC_QTY,</if>
            <if test="pbGrade!=null">PB_GRADE,</if>
            <if test="pbUser!=null">PB_USER,</if>
            <if test="pbQty!=null">PB_QTY,</if>
            <if test="repairDateTime!=null">REPAIR_DATE_TIME,</if>
            <if test="discover!=null">DISCOVER,</if>
            <if test="inspector!=null">INSPECTOR,</if>
            <if test="entityLocation!=null">ENTITY_LOCATION,</if>
            <if test="reportFrom!=null">REPORT_FROM,</if>
            <if test="objectBo!=null">OBJECT_BO,</if>
            <if test="pbPhotoshop!=null">PB_PHOTOSHOP,</if>
            <if test="cancelCode!=null">CANCEL_CODE,</if>
            <if test="cancelReason!=null">CANCEL_REASON,</if>
            <if test="cancelDateTime!=null">CANCEL_DATE_TIME,</if>
            <if test="cancelUser!=null">CANCEL_USER,</if>
            <if test="dutyUser!=null">DUTY_USER,</if>
            <if test="dutyDateTime!=null">DUTY_DATE_TIME,</if>
            <if test="dutyDepart!=null">DUTY_DEPART,</if>
            <if test="principalUser!=null">PRINCIPAL_USER,</if>
            <if test="dutyCauseDescription!=null">DUTY_CAUSE_DESCRIPTION,</if>
            <if test="dutyCauseType!=null">DUTY_CAUSE_TYPE,</if>
            <if test="dutyType!=null">DUTY_TYPE,</if>
            <if test="dutySendUserGroup!=null">DUTY_SEND_USER_GROUP,</if>
            <if test="resolveUser!=null">RESOLVE_USER,</if>
            <if test="resolveDateTime!=null">RESOLVE_DATE_TIME,</if>
            <if test="abnormalMethod!=null">ABNORMAL_METHOD,</if>
            <if test="routerBo!=null">ROUTER_BO,</if>
            <if test="resolveShopOrder!=null">RESOLVE_SHOP_ORDER,</if>
            <if test="resolveRemark!=null">RESOLVE_REMARK,</if>
            <if test="resolveSendUserGroup!=null">RESOLVE_SEND_USER_GROUP,</if>
            <if test="closedUser!=null">CLOSED_USER,</if>
            <if test="closedDateTime!=null">CLOSED_DATE_TIME,</if>
            <if test="abnormalReason!=null">ABNORMAL_REASON,</if>
            <if test="beforeMeasure!=null">BEFORE_MEASURE,</if>
            <if test="reportSendUserGroup!=null">REPORT_SEND_USER_GROUP,</if>
            <if test="cancelSendUserGroup!=null">CANCEL_SEND_USER_GROUP,</if>
            <if test="createdUser!=null">CREATED_USER,</if>
            <if test="createdDataTime!=null">CREATED_DATA_TIME,</if>
            <if test="modifiedUser!=null">MODIFIED_USER,</if>
            <if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
            <if test="productCategory!=null">PRODUCT_CATEGORY,</if>
            <if test="stepId!=null">STEP_ID,</if>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            <if test="site!=null">#{site},</if>
            <if test="abnormalNo!=null">#{abnormalNo},</if>
            <if test="status!=null">#{status},</if>
            <if test="type!=null">#{type},</if>
            <if test="itemBo!=null">#{itemBo},</if>
            <if test="sfc!=null">#{sfc},</if>
            <if test="operation!=null">#{operation},</if>
            <if test="workCenter!=null">#{workCenter},</if>
            <if test="shopOrder!=null">#{shopOrder},</if>
            <if test="messageType!=null">#{messageType},</if>
            <if test="resrce!=null">#{resrce},</if>
            <if test="ncCode!=null">#{ncCode},</if>
            <if test="ncCodeGroup!=null">#{ncCodeGroup},</if>
            <if test="shutDown!=null">#{shutDown},</if>
            <if test="responseUser!=null">#{responseUser},</if>
            <if test="responseDateTime!=null">#{responseDateTime},</if>
            <if test="pbDescription!=null">#{pbDescription},</if>
            <if test="ncQty!=null">#{ncQty},</if>
            <if test="pbGrade!=null">#{pbGrade},</if>
            <if test="pbUser!=null">#{pbUser},</if>
            <if test="pbQty!=null">#{pbQty},</if>
            <if test="repairDateTime!=null">#{repairDateTime},</if>
            <if test="discover!=null">#{discover},</if>
            <if test="inspector!=null">#{inspector},</if>
            <if test="entityLocation!=null">#{entityLocation},</if>
            <if test="reportFrom!=null">#{reportFrom},</if>
            <if test="objectBo!=null">#{objectBo},</if>
            <if test="pbPhotoshop!=null">#{pbPhotoshop},</if>
            <if test="cancelCode!=null">#{cancelCode},</if>
            <if test="cancelReason!=null">#{cancelReason},</if>
            <if test="cancelDateTime!=null">#{cancelDateTime},</if>
            <if test="cancelUser!=null">#{cancelUser},</if>
            <if test="dutyUser!=null">#{dutyUser},</if>
            <if test="dutyDateTime!=null">#{dutyDateTime},</if>
            <if test="dutyDepart!=null">#{dutyDepart},</if>
            <if test="principalUser!=null">#{principalUser},</if>
            <if test="dutyCauseDescription!=null">#{dutyCauseDescription},</if>
            <if test="dutyCauseType!=null">#{dutyCauseType},</if>
            <if test="dutyType!=null">#{dutyType},</if>
            <if test="dutySendUserGroup!=null">#{dutySendUserGroup},</if>
            <if test="resolveUser!=null">#{resolveUser},</if>
            <if test="resolveDateTime!=null">#{resolveDateTime},</if>
            <if test="abnormalMethod!=null">#{abnormalMethod},</if>
            <if test="routerBo!=null">#{routerBo},</if>
            <if test="resolveShopOrder!=null">#{resolveShopOrder},</if>
            <if test="resolveRemark!=null">#{resolveRemark},</if>
            <if test="resolveSendUserGroup!=null">#{resolveSendUserGroup},</if>
            <if test="closedUser!=null">#{closedUser},</if>
            <if test="closedDateTime!=null">#{closedDateTime},</if>
            <if test="abnormalReason!=null">#{abnormalReason},</if>
            <if test="beforeMeasure!=null">#{beforeMeasure},</if>
            <if test="reportSendUserGroup!=null">#{reportSendUserGroup},</if>
            <if test="cancelSendUserGroup!=null">#{cancelSendUserGroup},</if>
            <if test="createdUser!=null">#{createdUser},</if>
            <if test="createdDataTime!=null">#{createdDataTime},</if>
            <if test="modifiedUser!=null">#{modifiedUser},</if>
            <if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
            <if test="productCategory!=null">#{productCategory},</if>
            <if test="stepId!=null">#{stepId},</if>
        </trim>
    </insert>

    <insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.anomaly.model.AbnormalBillLog">
        INSERT INTO Z_ABNORMAL_BILL_LOG
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <include refid="Base_Column_List"></include>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            #{site},
            #{abnormalNo},
            #{status},
            #{type},
            #{itemBo},
            #{sfc},
            #{operation},
            #{workCenter},
            #{shopOrder},
            #{messageType},
            #{resrce},
            #{ncCode},
            #{ncCodeGroup},
            #{shutDown},
            #{responseUser},
            #{responseDateTime},
            #{pbDescription},
            #{ncQty},
            #{pbGrade},
            #{pbUser},
            #{pbQty},
            #{repairDateTime},
            #{discover},
            #{inspector},
            #{entityLocation},
            #{reportFrom},
            #{objectBo},
            #{pbPhotoshop},
            #{cancelCode},
            #{cancelReason},
            #{cancelDateTime},
            #{cancelUser},
            #{dutyUser},
            #{dutyDateTime},
            #{dutyDepart},
            #{principalUser},
            #{dutyCauseDescription},
            #{dutyCauseType},
            #{dutyType},
            #{dutySendUserGroup},
            #{resolveUser},
            #{resolveDateTime},
            #{abnormalMethod},
            #{routerBo},
            #{resolveShopOrder},
            #{resolveRemark},
            #{resolveSendUserGroup},
            #{closedUser},
            #{closedDateTime},
            #{abnormalReason},
            #{beforeMeasure},
            #{reportSendUserGroup},
            #{cancelSendUserGroup},
            #{createdUser},
            #{createdDataTime},
            #{modifiedUser},
            #{modifiedDateTime},
            #{productCategory},
            #{stepId},
        </trim>
    </insert>


    <update id="updateById">
        UPDATE Z_ABNORMAL_BILL_LOG <trim prefix="SET" suffixOverrides=",">
        <if test="et.site!=null">SITE=#{et.site},</if>
        <if test="et.abnormalNo!=null">ABNORMAL_NO=#{et.abnormalNo},</if>
        <if test="et.status!=null">STATUS=#{et.status},</if>
        <if test="et.type!=null">TYPE=#{et.type},</if>
        <if test="et.itemBo!=null">ITEM_BO=#{et.itemBo},</if>
        <if test="et.sfc!=null">SFC=#{et.sfc},</if>
        <if test="et.operation!=null">OPERATION=#{et.operation},</if>
        <if test="et.workCenter!=null">WORK_CENTER=#{et.workCenter},</if>
        <if test="et.shopOrder!=null">SHOP_ORDER=#{et.shopOrder},</if>
        <if test="et.messageType!=null">MESSAGE_TYPE=#{et.messageType},</if>
        <if test="et.resrce!=null">RESRCE=#{et.resrce},</if>
        <if test="et.ncCode!=null">NC_CODE=#{et.ncCode},</if>
        <if test="et.ncCodeGroup!=null">NC_CODE_GROUP=#{et.ncCodeGroup},</if>
        <if test="et.shutDown!=null">SHUT_DOWN=#{et.shutDown},</if>
        <if test="et.responseUser!=null">RESPONSE_USER=#{et.responseUser},</if>
        <if test="et.responseDateTime!=null">RESPONSE_DATE_TIME=#{et.responseDateTime},</if>
        <if test="et.pbDescription!=null">PB_DESCRIPTION=#{et.pbDescription},</if>
        <if test="et.ncQty!=null">NC_QTY=#{et.ncQty},</if>
        <if test="et.pbGrade!=null">PB_GRADE=#{et.pbGrade},</if>
        <if test="et.pbUser!=null">PB_USER=#{et.pbUser},</if>
        <if test="et.pbQty!=null">PB_QTY=#{et.pbQty},</if>
        <if test="et.repairDateTime!=null">REPAIR_DATE_TIME=#{et.repairDateTime},</if>
        <if test="et.discover!=null">DISCOVER=#{et.discover},</if>
        <if test="et.inspector!=null">INSPECTOR=#{et.inspector},</if>
        <if test="et.entityLocation!=null">ENTITY_LOCATION=#{et.entityLocation},</if>
        <if test="et.reportFrom!=null">REPORT_FROM=#{et.reportFrom},</if>
        <if test="et.objectBo!=null">OBJECT_BO=#{et.objectBo},</if>
        <if test="et.pbPhotoshop!=null">PB_PHOTOSHOP=#{et.pbPhotoshop},</if>
        <if test="et.cancelCode!=null">CANCEL_CODE=#{et.cancelCode},</if>
        <if test="et.cancelReason!=null">CANCEL_REASON=#{et.cancelReason},</if>
        <if test="et.cancelDateTime!=null">CANCEL_DATE_TIME=#{et.cancelDateTime},</if>
        <if test="et.cancelUser!=null">CANCEL_USER=#{et.cancelUser},</if>
        <if test="et.dutyUser!=null">DUTY_USER=#{et.dutyUser},</if>
        <if test="et.dutyDateTime!=null">DUTY_DATE_TIME=#{et.dutyDateTime},</if>
        <if test="et.dutyDepart!=null">DUTY_DEPART=#{et.dutyDepart},</if>
        <if test="et.principalUser!=null">PRINCIPAL_USER=#{et.principalUser},</if>
        <if test="et.dutyCauseDescription!=null">DUTY_CAUSE_DESCRIPTION=#{et.dutyCauseDescription},</if>
        <if test="et.dutyCauseType!=null">DUTY_CAUSE_TYPE=#{et.dutyCauseType},</if>
        <if test="et.dutyType!=null">DUTY_TYPE=#{et.dutyType},</if>
        <if test="et.dutySendUserGroup!=null">DUTY_SEND_USER_GROUP=#{et.dutySendUserGroup},</if>
        <if test="et.resolveUser!=null">RESOLVE_USER=#{et.resolveUser},</if>
        <if test="et.resolveDateTime!=null">RESOLVE_DATE_TIME=#{et.resolveDateTime},</if>
        <if test="et.abnormalMethod!=null">ABNORMAL_METHOD=#{et.abnormalMethod},</if>
        <if test="et.routerBo!=null">ROUTER_BO=#{et.routerBo},</if>
        <if test="et.resolveShopOrder!=null">RESOLVE_SHOP_ORDER=#{et.resolveShopOrder},</if>
        <if test="et.resolveRemark!=null">RESOLVE_REMARK=#{et.resolveRemark},</if>
        <if test="et.resolveSendUserGroup!=null">RESOLVE_SEND_USER_GROUP=#{et.resolveSendUserGroup},</if>
        <if test="et.closedUser!=null">CLOSED_USER=#{et.closedUser},</if>
        <if test="et.closedDateTime!=null">CLOSED_DATE_TIME=#{et.closedDateTime},</if>
        <if test="et.abnormalReason!=null">ABNORMAL_REASON=#{et.abnormalReason},</if>
        <if test="et.beforeMeasure!=null">BEFORE_MEASURE=#{et.beforeMeasure},</if>
        <if test="et.reportSendUserGroup!=null">REPORT_SEND_USER_GROUP=#{et.reportSendUserGroup},</if>
        <if test="et.cancelSendUserGroup!=null">CANCEL_SEND_USER_GROUP=#{et.cancelSendUserGroup},</if>
        <if test="et.createdUser!=null">CREATED_USER=#{et.createdUser},</if>
        <if test="et.createdDataTime!=null">CREATED_DATA_TIME=#{et.createdDataTime},</if>
        <if test="et.modifiedUser!=null">MODIFIED_USER=#{et.modifiedUser},</if>
        <if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
        <if test="et.productCategory!=null">PRODUCT_CATEGORY=#{et.productCategory},</if>
        <if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
        </trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
    </update>


    <update id="updateAllColumnById">
        UPDATE Z_ABNORMAL_BILL_LOG <trim prefix="SET" suffixOverrides=",">
        SITE=#{et.site},
        ABNORMAL_NO=#{et.abnormalNo},
        STATUS=#{et.status},
        TYPE=#{et.type},
        ITEM_BO=#{et.itemBo},
        SFC=#{et.sfc},
        OPERATION=#{et.operation},
        WORK_CENTER=#{et.workCenter},
        SHOP_ORDER=#{et.shopOrder},
        MESSAGE_TYPE=#{et.messageType},
        RESRCE=#{et.resrce},
        NC_CODE=#{et.ncCode},
        NC_CODE_GROUP=#{et.ncCodeGroup},
        SHUT_DOWN=#{et.shutDown},
        RESPONSE_USER=#{et.responseUser},
        RESPONSE_DATE_TIME=#{et.responseDateTime},
        PB_DESCRIPTION=#{et.pbDescription},
        NC_QTY=#{et.ncQty},
        PB_GRADE=#{et.pbGrade},
        PB_USER=#{et.pbUser},
        PB_QTY=#{et.pbQty},
        REPAIR_DATE_TIME=#{et.repairDateTime},
        DISCOVER=#{et.discover},
        INSPECTOR=#{et.inspector},
        ENTITY_LOCATION=#{et.entityLocation},
        REPORT_FROM=#{et.reportFrom},
        OBJECT_BO=#{et.objectBo},
        PB_PHOTOSHOP=#{et.pbPhotoshop},
        CANCEL_CODE=#{et.cancelCode},
        CANCEL_REASON=#{et.cancelReason},
        CANCEL_DATE_TIME=#{et.cancelDateTime},
        CANCEL_USER=#{et.cancelUser},
        DUTY_USER=#{et.dutyUser},
        DUTY_DATE_TIME=#{et.dutyDateTime},
        DUTY_DEPART=#{et.dutyDepart},
        PRINCIPAL_USER=#{et.principalUser},
        DUTY_CAUSE_DESCRIPTION=#{et.dutyCauseDescription},
        DUTY_CAUSE_TYPE=#{et.dutyCauseType},
        DUTY_TYPE=#{et.dutyType},
        DUTY_SEND_USER_GROUP=#{et.dutySendUserGroup},
        RESOLVE_USER=#{et.resolveUser},
        RESOLVE_DATE_TIME=#{et.resolveDateTime},
        ABNORMAL_METHOD=#{et.abnormalMethod},
        ROUTER_BO=#{et.routerBo},
        RESOLVE_SHOP_ORDER=#{et.resolveShopOrder},
        RESOLVE_REMARK=#{et.resolveRemark},
        RESOLVE_SEND_USER_GROUP=#{et.resolveSendUserGroup},
        CLOSED_USER=#{et.closedUser},
        CLOSED_DATE_TIME=#{et.closedDateTime},
        ABNORMAL_REASON=#{et.abnormalReason},
        BEFORE_MEASURE=#{et.beforeMeasure},
        REPORT_SEND_USER_GROUP=#{et.reportSendUserGroup},
        CANCEL_SEND_USER_GROUP=#{et.cancelSendUserGroup},
        CREATED_USER=#{et.createdUser},
        CREATED_DATA_TIME=#{et.createdDataTime},
        MODIFIED_USER=#{et.modifiedUser},
        MODIFIED_DATE_TIME=#{et.modifiedDateTime},
        PRODUCT_CATEGORY=#{et.productCategory},
        STEP_ID=#{et.stepId},
     </trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
    </update>


    <update id="update">
        UPDATE Z_ABNORMAL_BILL_LOG <trim prefix="SET" suffixOverrides=",">
        <if test="et.site!=null">SITE=#{et.site},</if>
        <if test="et.abnormalNo!=null">ABNORMAL_NO=#{et.abnormalNo},</if>
        <if test="et.status!=null">STATUS=#{et.status},</if>
        <if test="et.type!=null">TYPE=#{et.type},</if>
        <if test="et.itemBo!=null">ITEM_BO=#{et.itemBo},</if>
        <if test="et.sfc!=null">SFC=#{et.sfc},</if>
        <if test="et.operation!=null">OPERATION=#{et.operation},</if>
        <if test="et.workCenter!=null">WORK_CENTER=#{et.workCenter},</if>
        <if test="et.shopOrder!=null">SHOP_ORDER=#{et.shopOrder},</if>
        <if test="et.messageType!=null">MESSAGE_TYPE=#{et.messageType},</if>
        <if test="et.resrce!=null">RESRCE=#{et.resrce},</if>
        <if test="et.ncCode!=null">NC_CODE=#{et.ncCode},</if>
        <if test="et.ncCodeGroup!=null">NC_CODE_GROUP=#{et.ncCodeGroup},</if>
        <if test="et.shutDown!=null">SHUT_DOWN=#{et.shutDown},</if>
        <if test="et.responseUser!=null">RESPONSE_USER=#{et.responseUser},</if>
        <if test="et.responseDateTime!=null">RESPONSE_DATE_TIME=#{et.responseDateTime},</if>
        <if test="et.pbDescription!=null">PB_DESCRIPTION=#{et.pbDescription},</if>
        <if test="et.ncQty!=null">NC_QTY=#{et.ncQty},</if>
        <if test="et.pbGrade!=null">PB_GRADE=#{et.pbGrade},</if>
        <if test="et.pbUser!=null">PB_USER=#{et.pbUser},</if>
        <if test="et.pbQty!=null">PB_QTY=#{et.pbQty},</if>
        <if test="et.repairDateTime!=null">REPAIR_DATE_TIME=#{et.repairDateTime},</if>
        <if test="et.discover!=null">DISCOVER=#{et.discover},</if>
        <if test="et.inspector!=null">INSPECTOR=#{et.inspector},</if>
        <if test="et.entityLocation!=null">ENTITY_LOCATION=#{et.entityLocation},</if>
        <if test="et.reportFrom!=null">REPORT_FROM=#{et.reportFrom},</if>
        <if test="et.objectBo!=null">OBJECT_BO=#{et.objectBo},</if>
        <if test="et.pbPhotoshop!=null">PB_PHOTOSHOP=#{et.pbPhotoshop},</if>
        <if test="et.cancelCode!=null">CANCEL_CODE=#{et.cancelCode},</if>
        <if test="et.cancelReason!=null">CANCEL_REASON=#{et.cancelReason},</if>
        <if test="et.cancelDateTime!=null">CANCEL_DATE_TIME=#{et.cancelDateTime},</if>
        <if test="et.cancelUser!=null">CANCEL_USER=#{et.cancelUser},</if>
        <if test="et.dutyUser!=null">DUTY_USER=#{et.dutyUser},</if>
        <if test="et.dutyDateTime!=null">DUTY_DATE_TIME=#{et.dutyDateTime},</if>
        <if test="et.dutyDepart!=null">DUTY_DEPART=#{et.dutyDepart},</if>
        <if test="et.principalUser!=null">PRINCIPAL_USER=#{et.principalUser},</if>
        <if test="et.dutyCauseDescription!=null">DUTY_CAUSE_DESCRIPTION=#{et.dutyCauseDescription},</if>
        <if test="et.dutyCauseType!=null">DUTY_CAUSE_TYPE=#{et.dutyCauseType},</if>
        <if test="et.dutyType!=null">DUTY_TYPE=#{et.dutyType},</if>
        <if test="et.dutySendUserGroup!=null">DUTY_SEND_USER_GROUP=#{et.dutySendUserGroup},</if>
        <if test="et.resolveUser!=null">RESOLVE_USER=#{et.resolveUser},</if>
        <if test="et.resolveDateTime!=null">RESOLVE_DATE_TIME=#{et.resolveDateTime},</if>
        <if test="et.abnormalMethod!=null">ABNORMAL_METHOD=#{et.abnormalMethod},</if>
        <if test="et.routerBo!=null">ROUTER_BO=#{et.routerBo},</if>
        <if test="et.resolveShopOrder!=null">RESOLVE_SHOP_ORDER=#{et.resolveShopOrder},</if>
        <if test="et.resolveRemark!=null">RESOLVE_REMARK=#{et.resolveRemark},</if>
        <if test="et.resolveSendUserGroup!=null">RESOLVE_SEND_USER_GROUP=#{et.resolveSendUserGroup},</if>
        <if test="et.closedUser!=null">CLOSED_USER=#{et.closedUser},</if>
        <if test="et.closedDateTime!=null">CLOSED_DATE_TIME=#{et.closedDateTime},</if>
        <if test="et.abnormalReason!=null">ABNORMAL_REASON=#{et.abnormalReason},</if>
        <if test="et.beforeMeasure!=null">BEFORE_MEASURE=#{et.beforeMeasure},</if>
        <if test="et.reportSendUserGroup!=null">REPORT_SEND_USER_GROUP=#{et.reportSendUserGroup},</if>
        <if test="et.cancelSendUserGroup!=null">CANCEL_SEND_USER_GROUP=#{et.cancelSendUserGroup},</if>
        <if test="et.createdUser!=null">CREATED_USER=#{et.createdUser},</if>
        <if test="et.createdDataTime!=null">CREATED_DATA_TIME=#{et.createdDataTime},</if>
        <if test="et.modifiedUser!=null">MODIFIED_USER=#{et.modifiedUser},</if>
        <if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
        <if test="et.productCategory!=null">PRODUCT_CATEGORY=#{et.productCategory},</if>
        <if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
    </trim>
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    HANDLE=#{ew.entity.handle}
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
                    <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
                    <if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
                    <if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
                    <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
                    <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
                    <if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
                    <if test="ew.entity.ncCodeGroup!=null"> AND NC_CODE_GROUP=#{ew.entity.ncCodeGroup}</if>
                    <if test="ew.entity.shutDown!=null"> AND SHUT_DOWN=#{ew.entity.shutDown}</if>
                    <if test="ew.entity.responseUser!=null"> AND RESPONSE_USER=#{ew.entity.responseUser}</if>
                    <if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
                    <if test="ew.entity.pbDescription!=null"> AND PB_DESCRIPTION=#{ew.entity.pbDescription}</if>
                    <if test="ew.entity.ncQty!=null"> AND NC_QTY=#{ew.entity.ncQty}</if>
                    <if test="ew.entity.pbGrade!=null"> AND PB_GRADE=#{ew.entity.pbGrade}</if>
                    <if test="ew.entity.pbUser!=null"> AND PB_USER=#{ew.entity.pbUser}</if>
                    <if test="ew.entity.pbQty!=null"> AND PB_QTY=#{ew.entity.pbQty}</if>
                    <if test="ew.entity.repairDateTime!=null"> AND REPAIR_DATE_TIME=#{ew.entity.repairDateTime}</if>
                    <if test="ew.entity.discover!=null"> AND DISCOVER=#{ew.entity.discover}</if>
                    <if test="ew.entity.inspector!=null"> AND INSPECTOR=#{ew.entity.inspector}</if>
                    <if test="ew.entity.entityLocation!=null"> AND ENTITY_LOCATION=#{ew.entity.entityLocation}</if>
                    <if test="ew.entity.reportFrom!=null"> AND REPORT_FROM=#{ew.entity.reportFrom}</if>
                    <if test="ew.entity.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
                    <if test="ew.entity.pbPhotoshop!=null"> AND PB_PHOTOSHOP=#{ew.entity.pbPhotoshop}</if>
                    <if test="ew.entity.cancelCode!=null"> AND CANCEL_CODE=#{ew.entity.cancelCode}</if>
                    <if test="ew.entity.cancelReason!=null"> AND CANCEL_REASON=#{ew.entity.cancelReason}</if>
                    <if test="ew.entity.cancelDateTime!=null"> AND CANCEL_DATE_TIME=#{ew.entity.cancelDateTime}</if>
                    <if test="ew.entity.cancelUser!=null"> AND CANCEL_USER=#{ew.entity.cancelUser}</if>
                    <if test="ew.entity.dutyUser!=null"> AND DUTY_USER=#{ew.entity.dutyUser}</if>
                    <if test="ew.entity.dutyDateTime!=null"> AND DUTY_DATE_TIME=#{ew.entity.dutyDateTime}</if>
                    <if test="ew.entity.dutyDepart!=null"> AND DUTY_DEPART=#{ew.entity.dutyDepart}</if>
                    <if test="ew.entity.principalUser!=null"> AND PRINCIPAL_USER=#{ew.entity.principalUser}</if>
                    <if test="ew.entity.dutyCauseDescription!=null"> AND DUTY_CAUSE_DESCRIPTION=#{ew.entity.dutyCauseDescription}</if>
                    <if test="ew.entity.dutyCauseType!=null"> AND DUTY_CAUSE_TYPE=#{ew.entity.dutyCauseType}</if>
                    <if test="ew.entity.dutyType!=null"> AND DUTY_TYPE=#{ew.entity.dutyType}</if>
                    <if test="ew.entity.dutySendUserGroup!=null"> AND DUTY_SEND_USER_GROUP=#{ew.entity.dutySendUserGroup}</if>
                    <if test="ew.entity.resolveUser!=null"> AND RESOLVE_USER=#{ew.entity.resolveUser}</if>
                    <if test="ew.entity.resolveDateTime!=null"> AND RESOLVE_DATE_TIME=#{ew.entity.resolveDateTime}</if>
                    <if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
                    <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
                    <if test="ew.entity.resolveShopOrder!=null"> AND RESOLVE_SHOP_ORDER=#{ew.entity.resolveShopOrder}</if>
                    <if test="ew.entity.resolveRemark!=null"> AND RESOLVE_REMARK=#{ew.entity.resolveRemark}</if>
                    <if test="ew.entity.resolveSendUserGroup!=null"> AND RESOLVE_SEND_USER_GROUP=#{ew.entity.resolveSendUserGroup}</if>
                    <if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
                    <if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
                    <if test="ew.entity.abnormalReason!=null"> AND ABNORMAL_REASON=#{ew.entity.abnormalReason}</if>
                    <if test="ew.entity.beforeMeasure!=null"> AND BEFORE_MEASURE=#{ew.entity.beforeMeasure}</if>
                    <if test="ew.entity.reportSendUserGroup!=null"> AND REPORT_SEND_USER_GROUP=#{ew.entity.reportSendUserGroup}</if>
                    <if test="ew.entity.cancelSendUserGroup!=null"> AND CANCEL_SEND_USER_GROUP=#{ew.entity.cancelSendUserGroup}</if>
                    <if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
                    <if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
                    <if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.productCategory!=null"> AND PRODUCT_CATEGORY=#{ew.entity.productCategory}</if>
                    <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</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="deleteById">
        DELETE FROM Z_ABNORMAL_BILL_LOG WHERE HANDLE=#{handle}
    </delete>

    <delete id="deleteByMap">
        DELETE FROM Z_ABNORMAL_BILL_LOG
        <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 Z_ABNORMAL_BILL_LOG
        <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.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
                    <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
                    <if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
                    <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
                    <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
                    <if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
                    <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
                    <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
                    <if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
                    <if test="ew.entity.ncCodeGroup!=null"> AND NC_CODE_GROUP=#{ew.entity.ncCodeGroup}</if>
                    <if test="ew.entity.shutDown!=null"> AND SHUT_DOWN=#{ew.entity.shutDown}</if>
                    <if test="ew.entity.responseUser!=null"> AND RESPONSE_USER=#{ew.entity.responseUser}</if>
                    <if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
                    <if test="ew.entity.pbDescription!=null"> AND PB_DESCRIPTION=#{ew.entity.pbDescription}</if>
                    <if test="ew.entity.ncQty!=null"> AND NC_QTY=#{ew.entity.ncQty}</if>
                    <if test="ew.entity.pbGrade!=null"> AND PB_GRADE=#{ew.entity.pbGrade}</if>
                    <if test="ew.entity.pbUser!=null"> AND PB_USER=#{ew.entity.pbUser}</if>
                    <if test="ew.entity.pbQty!=null"> AND PB_QTY=#{ew.entity.pbQty}</if>
                    <if test="ew.entity.repairDateTime!=null"> AND REPAIR_DATE_TIME=#{ew.entity.repairDateTime}</if>
                    <if test="ew.entity.discover!=null"> AND DISCOVER=#{ew.entity.discover}</if>
                    <if test="ew.entity.inspector!=null"> AND INSPECTOR=#{ew.entity.inspector}</if>
                    <if test="ew.entity.entityLocation!=null"> AND ENTITY_LOCATION=#{ew.entity.entityLocation}</if>
                    <if test="ew.entity.reportFrom!=null"> AND REPORT_FROM=#{ew.entity.reportFrom}</if>
                    <if test="ew.entity.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
                    <if test="ew.entity.pbPhotoshop!=null"> AND PB_PHOTOSHOP=#{ew.entity.pbPhotoshop}</if>
                    <if test="ew.entity.cancelCode!=null"> AND CANCEL_CODE=#{ew.entity.cancelCode}</if>
                    <if test="ew.entity.cancelReason!=null"> AND CANCEL_REASON=#{ew.entity.cancelReason}</if>
                    <if test="ew.entity.cancelDateTime!=null"> AND CANCEL_DATE_TIME=#{ew.entity.cancelDateTime}</if>
                    <if test="ew.entity.cancelUser!=null"> AND CANCEL_USER=#{ew.entity.cancelUser}</if>
                    <if test="ew.entity.dutyUser!=null"> AND DUTY_USER=#{ew.entity.dutyUser}</if>
                    <if test="ew.entity.dutyDateTime!=null"> AND DUTY_DATE_TIME=#{ew.entity.dutyDateTime}</if>
                    <if test="ew.entity.dutyDepart!=null"> AND DUTY_DEPART=#{ew.entity.dutyDepart}</if>
                    <if test="ew.entity.principalUser!=null"> AND PRINCIPAL_USER=#{ew.entity.principalUser}</if>
                    <if test="ew.entity.dutyCauseDescription!=null"> AND DUTY_CAUSE_DESCRIPTION=#{ew.entity.dutyCauseDescription}</if>
                    <if test="ew.entity.dutyCauseType!=null"> AND DUTY_CAUSE_TYPE=#{ew.entity.dutyCauseType}</if>
                    <if test="ew.entity.dutyType!=null"> AND DUTY_TYPE=#{ew.entity.dutyType}</if>
                    <if test="ew.entity.dutySendUserGroup!=null"> AND DUTY_SEND_USER_GROUP=#{ew.entity.dutySendUserGroup}</if>
                    <if test="ew.entity.resolveUser!=null"> AND RESOLVE_USER=#{ew.entity.resolveUser}</if>
                    <if test="ew.entity.resolveDateTime!=null"> AND RESOLVE_DATE_TIME=#{ew.entity.resolveDateTime}</if>
                    <if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
                    <if test="ew.entity.routerBo!=null"> AND ROUTER_BO=#{ew.entity.routerBo}</if>
                    <if test="ew.entity.resolveShopOrder!=null"> AND RESOLVE_SHOP_ORDER=#{ew.entity.resolveShopOrder}</if>
                    <if test="ew.entity.resolveRemark!=null"> AND RESOLVE_REMARK=#{ew.entity.resolveRemark}</if>
                    <if test="ew.entity.resolveSendUserGroup!=null"> AND RESOLVE_SEND_USER_GROUP=#{ew.entity.resolveSendUserGroup}</if>
                    <if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
                    <if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
                    <if test="ew.entity.abnormalReason!=null"> AND ABNORMAL_REASON=#{ew.entity.abnormalReason}</if>
                    <if test="ew.entity.beforeMeasure!=null"> AND BEFORE_MEASURE=#{ew.entity.beforeMeasure}</if>
                    <if test="ew.entity.reportSendUserGroup!=null"> AND REPORT_SEND_USER_GROUP=#{ew.entity.reportSendUserGroup}</if>
                    <if test="ew.entity.cancelSendUserGroup!=null"> AND CANCEL_SEND_USER_GROUP=#{ew.entity.cancelSendUserGroup}</if>
                    <if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
                    <if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
                    <if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.productCategory!=null"> AND PRODUCT_CATEGORY=#{ew.entity.productCategory}</if>
                    <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</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>

    <delete id="deleteBatchIds">
        DELETE FROM Z_ABNORMAL_BILL_LOG WHERE HANDLE IN (
        <foreach item="item" index="index" collection="coll" separator=",">#{item}
        </foreach>)
    </delete>
    <!-- BaseMapper标准查询/修改/删除 -->

    <select id="findAllByAbnormalNo" resultMap="BaseResultMap">
        SELECT zab.HANDLE HANDLE ,zab.SITE SITE ,zab.ABNORMAL_NO ABNORMAL_NO ,zab.STATUS STATUS ,
        zab."TYPE" "TYPE" ,zab.ITEM_BO ITEM_BO ,zab.SFC SFC ,zab.OPERATION OPERATION ,
        zab.WORK_CENTER ,WORK_CENTER ,zab.SHOP_ORDER SHOP_ORDER ,zab.MESSAGE_TYPE MESSAGE_TYPE ,
        zab.RESRCE RESRCE ,zab.NC_CODE NC_CODE,zab.SHUT_DOWN SHUT_DOWN ,zab.RESPONSE_USER RESPONSE_USER ,
        zab.RESPONSE_DATE_TIME RESPONSE_DATE_TIME ,zab.PB_DESCRIPTION PB_DESCRIPTION ,zab.NC_QTY NC_QTY ,
        zab.PB_GRADE PB_GRADE ,zab.PB_USER PB_USER ,zab.PB_QTY PB_QTY ,zab.REPAIR_DATE_TIME REPAIR_DATE_TIME ,
        zab.DISCOVER DISCOVER ,zab.INSPECTOR INSPECTOR ,zab.ENTITY_LOCATION ENTITY_LOCATION ,zab.REPORT_FROM REPORT_FROM ,
        zab.OBJECT_BO OBJECT_BO ,zab.PB_PHOTOSHOP PB_PHOTOSHOP ,zab.CANCEL_CODE CANCEL_CODE ,zab.CANCEL_REASON CANCEL_REASON ,
        zab.CANCEL_DATE_TIME CANCEL_DATE_TIME ,zab.CANCEL_USER CANCEL_USER ,zabd.DUTY_USER DUTY_USER,zabd.DUTY_DATE_TIME DUTY_DATE_TIME,
        zabd.DUTY_DEPART DUTY_DEPART,zabd.PRINCIPAL_USER PRINCIPAL_USER,zabd.DUTY_CAUSE_DESCRIPTION DUTY_CAUSE_DESCRIPTION,
        zabd.DUTY_CAUSE_TYPE DUTY_CAUSE_TYPE,zabd.DUTY_TYPE DUTY_TYPE,zabd.DUTY_SEND_USER_GROUP DUTY_SEND_USER_GROUP,
        zabd.RESOLVE_USER  RESOLVE_USER,zabd.RESOLVE_DATE_TIME RESOLVE_DATE_TIME,zabd.ABNORMAL_METHOD ABNORMAL_METHOD,
        zabd.ROUTER_BO ROUTER_BO,zabd.RESOLVE_SHOP_ORDER RESOLVE_SHOP_ORDER,zabd.RESOLVE_REMARK RESOLVE_REMARK,
        zabd.RESOLVE_SEND_USER_GROUP RESOLVE_SEND_USER_GROUP,zabd.CLOSED_USER CLOSED_USER,zabd.CLOSED_DATE_TIME CLOSED_DATE_TIME,
        zabd.ABNORMAL_REASON ABNORMAL_REASON,zabd.BEFORE_MEASURE BEFORE_MEASURE,zab.REPORT_SEND_USER_GROUP REPORT_SEND_USER_GROUP,
        zab.CANCEL_SEND_USER_GROUP CANCEL_SEND_USER_GROUP,zab.PRODUCT_CATEGORY PRODUCT_CATEGORY,zab.STEP_ID STEP_ID
        FROM Z_ABNORMAL_BILL zab
        INNER JOIN Z_ABNORMAL_BILL_DISPOSE zabd ON zab.HANDLE = zabd.ABNORMAL_BILL_BO
        <where>
            <if test="abnormalBill != null">
                <if test="abnormalBill.site != null and abnormalBill.site != ''">
                    ZAB.SITE = #{abnormalBill.site}
                </if>
                <if test="abnormalBill.abnormalNo != null and abnormalBill.abnormalNo != ''">
                    AND ZAB.ABNORMAL_NO = #{abnormalBill.abnormalNo}
                </if>
            </if>
        </where>
    </select>
</mapper>
