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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.foreverwin.mesnac.anomaly.model.AbnormalBill">
        <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="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="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="INSPECTER" property="inspecter" />
        <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="CREATED_USER" property="createdUser" />
        <result column="CREATED_DATA_TIME" property="createdDataTime" />
        <result column="MODIFIED_USER" property="modifiedUser" />
        <result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        HANDLE, SITE, ABNORMAL_NO, STATUS, TYPE, ITEM_BO, SFC, WORK_CENTER, SHOP_ORDER, MESSAGE_TYPE, RESRCE, NC_CODE, SHUT_DOWN, RESPONSE_USER, RESPONSE_DATE_TIME, PB_DESCRIPTION, NC_QTY, PB_GRADE, PB_USER, PB_QTY, REPAIR_DATE_TIME, DISCOVER, INSPECTER, ENTITY_LOCATION, REPORT_FROM, OBJECT_BO, PB_PHOTOSHOP, CANCEL_CODE, CANCEL_REASON, CANCEL_DATE_TIME, CANCEL_USER, CREATED_USER, CREATED_DATA_TIME, MODIFIED_USER, MODIFIED_DATE_TIME
    </sql>

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

    <select id="selectByMap" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include>
        FROM Z_ABNORMAL_BILL
        <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 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
        <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.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.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.inspecter!=null"> AND INSPECTER=#{ew.entity.inspecter}</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.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>
        </where>
    </select>

    <select id="selectCount" resultType="Integer">
        SELECT COUNT(1) FROM Z_ABNORMAL_BILL
        <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.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.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.inspecter!=null"> AND INSPECTER=#{ew.entity.inspecter}</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.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>
                <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
        <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.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.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.inspecter!=null"> AND INSPECTER=#{ew.entity.inspecter}</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.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>
                <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
        <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.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.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.inspecter!=null"> AND INSPECTER=#{ew.entity.inspecter}</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.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>
                <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
        <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.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.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.inspecter!=null"> AND INSPECTER=#{ew.entity.inspecter}</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.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>
                <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
        <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.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.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.inspecter!=null"> AND INSPECTER=#{ew.entity.inspecter}</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.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>
                <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
        <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.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.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.inspecter!=null"> AND INSPECTER=#{ew.entity.inspecter}</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.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>
                <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.AbnormalBill">
        INSERT INTO Z_ABNORMAL_BILL
        <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="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="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="inspecter!=null">INSPECTER,</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="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>
        </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="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="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="inspecter!=null">#{inspecter},</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="createdUser!=null">#{createdUser},</if>
            <if test="createdDataTime!=null">#{createdDataTime},</if>
            <if test="modifiedUser!=null">#{modifiedUser},</if>
            <if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
        </trim>
    </insert>

    <insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.anomaly.model.AbnormalBill">
        INSERT INTO Z_ABNORMAL_BILL
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <include refid="Base_Column_List"></include>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            #{site},
            #{abnormalNo},
            #{status},
            #{type},
            #{itemBo},
            #{sfc},
            #{workCenter},
            #{shopOrder},
            #{messageType},
            #{resrce},
            #{ncCode},
            #{shutDown},
            #{responseUser},
            #{responseDateTime},
            #{pbDescription},
            #{ncQty},
            #{pbGrade},
            #{pbUser},
            #{pbQty},
            #{repairDateTime},
            #{discover},
            #{inspecter},
            #{entityLocation},
            #{reportFrom},
            #{objectBo},
            #{pbPhotoshop},
            #{cancelCode},
            #{cancelReason},
            #{cancelDateTime},
            #{cancelUser},
            #{createdUser},
            #{createdDataTime},
            #{modifiedUser},
            #{modifiedDateTime},
        </trim>
    </insert>


    <update id="updateById">
        UPDATE Z_ABNORMAL_BILL <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.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.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.inspecter!=null">INSPECTER=#{et.inspecter},</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.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>
        </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 <trim prefix="SET" suffixOverrides=",">
        SITE=#{et.site},
        ABNORMAL_NO=#{et.abnormalNo},
        STATUS=#{et.status},
        TYPE=#{et.type},
        ITEM_BO=#{et.itemBo},
        SFC=#{et.sfc},
        WORK_CENTER=#{et.workCenter},
        SHOP_ORDER=#{et.shopOrder},
        MESSAGE_TYPE=#{et.messageType},
        RESRCE=#{et.resrce},
        NC_CODE=#{et.ncCode},
        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},
        INSPECTER=#{et.inspecter},
        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},
        CREATED_USER=#{et.createdUser},
        CREATED_DATA_TIME=#{et.createdDataTime},
        MODIFIED_USER=#{et.modifiedUser},
        MODIFIED_DATE_TIME=#{et.modifiedDateTime},
     </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 <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.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.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.inspecter!=null">INSPECTER=#{et.inspecter},</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.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>
    </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.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.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.inspecter!=null"> AND INSPECTER=#{ew.entity.inspecter}</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.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>
                <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 WHERE HANDLE=#{handle}
    </delete>

    <delete id="deleteByMap">
        DELETE FROM Z_ABNORMAL_BILL
        <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
        <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.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.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.inspecter!=null"> AND INSPECTER=#{ew.entity.inspecter}</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.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>
                <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 WHERE HANDLE IN (
        <foreach item="item" index="index" collection="coll" separator=",">#{item}
        </foreach>)
    </delete>
    <!-- BaseMapper标准查询/修改/删除 -->

</mapper>
