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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.foreverwin.mesnac.anomaly.model.WorkHourStatistics">
        <id column="HANDLE" property="handle"/>
        <result column="SITE" property="site"/>
        <result column="WORK_CENTER_DESCRIPTION" property="workCenterDescription"/>
        <result column="JOBS" property="jobs"/>
        <result column="USER_NAME" property="userName"/>
        <result column="DELAYS_HOURS" property="delaysHours"/>
        <result column="AVERAGE_HOURS" property="averageHours"/>
        <result column="TEMPORARY_HOURS" property="temporaryHours"/>
        <result column="NEW_PRODUCT_HOURS" property="newProductHours"/>
        <result column="REPAIR_HOURS" property="repairHours"/>
        <result column="WORK_CONTACT_HOURS" property="workContactHours"/>
        <result column="QUALITY_REWORK_HOURS" property="qualityReworkHours"/>
        <result column="NORMAL_HOURS" property="normalHours"/>
        <result column="TOTAL_HOURS" property="totalHours"/>
        <result column="STANDARD_HOURS" property="standardHours"/>
        <result column="OVERTIME_HOURS" property="overtimeHours"/>
        <result column="MONTH_DAYS" property="monthDays"/>
        <result column="OTHER_ONE" property="otherOne"/>
        <result column="OTHER_TWO" property="otherTwo"/>
        <result column="CREATED_BY" property="createdBy"/>
        <result column="CREATED_TIME" property="createdTime"/>
        <result column="UPDATED_BY" property="updatedBy"/>
        <result column="UPDATED_TIME" property="updatedTime"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        HANDLE, SITE, WORK_CENTER_DESCRIPTION, JOBS, USER_NAME, DELAYS_HOURS, AVERAGE_HOURS, TEMPORARY_HOURS,
        NEW_PRODUCT_HOURS, REPAIR_HOURS, WORK_CONTACT_HOURS, QUALITY_REWORK_HOURS, NORMAL_HOURS, TOTAL_HOURS,
        STANDARD_HOURS, OVERTIME_HOURS, MONTH_DAYS, OTHER_ONE, OTHER_TWO, CREATED_BY, CREATED_TIME, UPDATED_BY,
        UPDATED_TIME
    </sql>

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

    <select id="selectByMap" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"></include>
        FROM Z_WORK_HOUR_STATISTICS
        <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_WORK_HOUR_STATISTICS 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_WORK_HOUR_STATISTICS
        <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.workCenterDescription!=null">AND
                WORK_CENTER_DESCRIPTION=#{ew.entity.workCenterDescription}
            </if>
            <if test="ew.entity.jobs!=null">AND JOBS=#{ew.entity.jobs}</if>
            <if test="ew.entity.userName!=null">AND USER_NAME=#{ew.entity.userName}</if>
            <if test="ew.entity.delaysHours!=null">AND DELAYS_HOURS=#{ew.entity.delaysHours}</if>
            <if test="ew.entity.averageHours!=null">AND AVERAGE_HOURS=#{ew.entity.averageHours}</if>
            <if test="ew.entity.temporaryHours!=null">AND TEMPORARY_HOURS=#{ew.entity.temporaryHours}</if>
            <if test="ew.entity.newProductHours!=null">AND NEW_PRODUCT_HOURS=#{ew.entity.newProductHours}</if>
            <if test="ew.entity.repairHours!=null">AND REPAIR_HOURS=#{ew.entity.repairHours}</if>
            <if test="ew.entity.workContactHours!=null">AND WORK_CONTACT_HOURS=#{ew.entity.workContactHours}</if>
            <if test="ew.entity.qualityReworkHours!=null">AND QUALITY_REWORK_HOURS=#{ew.entity.qualityReworkHours}</if>
            <if test="ew.entity.normalHours!=null">AND NORMAL_HOURS=#{ew.entity.normalHours}</if>
            <if test="ew.entity.totalHours!=null">AND TOTAL_HOURS=#{ew.entity.totalHours}</if>
            <if test="ew.entity.standardHours!=null">AND STANDARD_HOURS=#{ew.entity.standardHours}</if>
            <if test="ew.entity.overtimeHours!=null">AND OVERTIME_HOURS=#{ew.entity.overtimeHours}</if>
            <if test="ew.entity.monthDays!=null">AND MONTH_DAYS=#{ew.entity.monthDays}</if>
            <if test="ew.entity.otherOne!=null">AND OTHER_ONE=#{ew.entity.otherOne}</if>
            <if test="ew.entity.otherTwo!=null">AND OTHER_TWO=#{ew.entity.otherTwo}</if>
            <if test="ew.entity.createdBy!=null">AND CREATED_BY=#{ew.entity.createdBy}</if>
            <if test="ew.entity.createdTime!=null">AND CREATED_TIME=#{ew.entity.createdTime}</if>
            <if test="ew.entity.updatedBy!=null">AND UPDATED_BY=#{ew.entity.updatedBy}</if>
            <if test="ew.entity.updatedTime!=null">AND UPDATED_TIME=#{ew.entity.updatedTime}</if>
        </where>
    </select>

    <select id="selectCount" resultType="Integer">
        SELECT COUNT(1) FROM Z_WORK_HOUR_STATISTICS
        <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.workCenterDescription!=null">AND
                        WORK_CENTER_DESCRIPTION=#{ew.entity.workCenterDescription}
                    </if>
                    <if test="ew.entity.jobs!=null">AND JOBS=#{ew.entity.jobs}</if>
                    <if test="ew.entity.userName!=null">AND USER_NAME=#{ew.entity.userName}</if>
                    <if test="ew.entity.delaysHours!=null">AND DELAYS_HOURS=#{ew.entity.delaysHours}</if>
                    <if test="ew.entity.averageHours!=null">AND AVERAGE_HOURS=#{ew.entity.averageHours}</if>
                    <if test="ew.entity.temporaryHours!=null">AND TEMPORARY_HOURS=#{ew.entity.temporaryHours}</if>
                    <if test="ew.entity.newProductHours!=null">AND NEW_PRODUCT_HOURS=#{ew.entity.newProductHours}</if>
                    <if test="ew.entity.repairHours!=null">AND REPAIR_HOURS=#{ew.entity.repairHours}</if>
                    <if test="ew.entity.workContactHours!=null">AND WORK_CONTACT_HOURS=#{ew.entity.workContactHours}
                    </if>
                    <if test="ew.entity.qualityReworkHours!=null">AND
                        QUALITY_REWORK_HOURS=#{ew.entity.qualityReworkHours}
                    </if>
                    <if test="ew.entity.normalHours!=null">AND NORMAL_HOURS=#{ew.entity.normalHours}</if>
                    <if test="ew.entity.totalHours!=null">AND TOTAL_HOURS=#{ew.entity.totalHours}</if>
                    <if test="ew.entity.standardHours!=null">AND STANDARD_HOURS=#{ew.entity.standardHours}</if>
                    <if test="ew.entity.overtimeHours!=null">AND OVERTIME_HOURS=#{ew.entity.overtimeHours}</if>
                    <if test="ew.entity.monthDays!=null">AND MONTH_DAYS=#{ew.entity.monthDays}</if>
                    <if test="ew.entity.otherOne!=null">AND OTHER_ONE=#{ew.entity.otherOne}</if>
                    <if test="ew.entity.otherTwo!=null">AND OTHER_TWO=#{ew.entity.otherTwo}</if>
                    <if test="ew.entity.createdBy!=null">AND CREATED_BY=#{ew.entity.createdBy}</if>
                    <if test="ew.entity.createdTime!=null">AND CREATED_TIME=#{ew.entity.createdTime}</if>
                    <if test="ew.entity.updatedBy!=null">AND UPDATED_BY=#{ew.entity.updatedBy}</if>
                    <if test="ew.entity.updatedTime!=null">AND UPDATED_TIME=#{ew.entity.updatedTime}</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_WORK_HOUR_STATISTICS
        <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.workCenterDescription!=null">AND
                        WORK_CENTER_DESCRIPTION=#{ew.entity.workCenterDescription}
                    </if>
                    <if test="ew.entity.jobs!=null">AND JOBS=#{ew.entity.jobs}</if>
                    <if test="ew.entity.userName!=null">AND USER_NAME=#{ew.entity.userName}</if>
                    <if test="ew.entity.delaysHours!=null">AND DELAYS_HOURS=#{ew.entity.delaysHours}</if>
                    <if test="ew.entity.averageHours!=null">AND AVERAGE_HOURS=#{ew.entity.averageHours}</if>
                    <if test="ew.entity.temporaryHours!=null">AND TEMPORARY_HOURS=#{ew.entity.temporaryHours}</if>
                    <if test="ew.entity.newProductHours!=null">AND NEW_PRODUCT_HOURS=#{ew.entity.newProductHours}</if>
                    <if test="ew.entity.repairHours!=null">AND REPAIR_HOURS=#{ew.entity.repairHours}</if>
                    <if test="ew.entity.workContactHours!=null">AND WORK_CONTACT_HOURS=#{ew.entity.workContactHours}
                    </if>
                    <if test="ew.entity.qualityReworkHours!=null">AND
                        QUALITY_REWORK_HOURS=#{ew.entity.qualityReworkHours}
                    </if>
                    <if test="ew.entity.normalHours!=null">AND NORMAL_HOURS=#{ew.entity.normalHours}</if>
                    <if test="ew.entity.totalHours!=null">AND TOTAL_HOURS=#{ew.entity.totalHours}</if>
                    <if test="ew.entity.standardHours!=null">AND STANDARD_HOURS=#{ew.entity.standardHours}</if>
                    <if test="ew.entity.overtimeHours!=null">AND OVERTIME_HOURS=#{ew.entity.overtimeHours}</if>
                    <if test="ew.entity.monthDays!=null">AND MONTH_DAYS=#{ew.entity.monthDays}</if>
                    <if test="ew.entity.otherOne!=null">AND OTHER_ONE=#{ew.entity.otherOne}</if>
                    <if test="ew.entity.otherTwo!=null">AND OTHER_TWO=#{ew.entity.otherTwo}</if>
                    <if test="ew.entity.createdBy!=null">AND CREATED_BY=#{ew.entity.createdBy}</if>
                    <if test="ew.entity.createdTime!=null">AND CREATED_TIME=#{ew.entity.createdTime}</if>
                    <if test="ew.entity.updatedBy!=null">AND UPDATED_BY=#{ew.entity.updatedBy}</if>
                    <if test="ew.entity.updatedTime!=null">AND UPDATED_TIME=#{ew.entity.updatedTime}</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_WORK_HOUR_STATISTICS
        <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.workCenterDescription!=null">AND
                        WORK_CENTER_DESCRIPTION=#{ew.entity.workCenterDescription}
                    </if>
                    <if test="ew.entity.jobs!=null">AND JOBS=#{ew.entity.jobs}</if>
                    <if test="ew.entity.userName!=null">AND USER_NAME=#{ew.entity.userName}</if>
                    <if test="ew.entity.delaysHours!=null">AND DELAYS_HOURS=#{ew.entity.delaysHours}</if>
                    <if test="ew.entity.averageHours!=null">AND AVERAGE_HOURS=#{ew.entity.averageHours}</if>
                    <if test="ew.entity.temporaryHours!=null">AND TEMPORARY_HOURS=#{ew.entity.temporaryHours}</if>
                    <if test="ew.entity.newProductHours!=null">AND NEW_PRODUCT_HOURS=#{ew.entity.newProductHours}</if>
                    <if test="ew.entity.repairHours!=null">AND REPAIR_HOURS=#{ew.entity.repairHours}</if>
                    <if test="ew.entity.workContactHours!=null">AND WORK_CONTACT_HOURS=#{ew.entity.workContactHours}
                    </if>
                    <if test="ew.entity.qualityReworkHours!=null">AND
                        QUALITY_REWORK_HOURS=#{ew.entity.qualityReworkHours}
                    </if>
                    <if test="ew.entity.normalHours!=null">AND NORMAL_HOURS=#{ew.entity.normalHours}</if>
                    <if test="ew.entity.totalHours!=null">AND TOTAL_HOURS=#{ew.entity.totalHours}</if>
                    <if test="ew.entity.standardHours!=null">AND STANDARD_HOURS=#{ew.entity.standardHours}</if>
                    <if test="ew.entity.overtimeHours!=null">AND OVERTIME_HOURS=#{ew.entity.overtimeHours}</if>
                    <if test="ew.entity.monthDays!=null">AND MONTH_DAYS=#{ew.entity.monthDays}</if>
                    <if test="ew.entity.otherOne!=null">AND OTHER_ONE=#{ew.entity.otherOne}</if>
                    <if test="ew.entity.otherTwo!=null">AND OTHER_TWO=#{ew.entity.otherTwo}</if>
                    <if test="ew.entity.createdBy!=null">AND CREATED_BY=#{ew.entity.createdBy}</if>
                    <if test="ew.entity.createdTime!=null">AND CREATED_TIME=#{ew.entity.createdTime}</if>
                    <if test="ew.entity.updatedBy!=null">AND UPDATED_BY=#{ew.entity.updatedBy}</if>
                    <if test="ew.entity.updatedTime!=null">AND UPDATED_TIME=#{ew.entity.updatedTime}</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_WORK_HOUR_STATISTICS
        <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.workCenterDescription!=null">AND
                        WORK_CENTER_DESCRIPTION=#{ew.entity.workCenterDescription}
                    </if>
                    <if test="ew.entity.jobs!=null">AND JOBS=#{ew.entity.jobs}</if>
                    <if test="ew.entity.userName!=null">AND USER_NAME=#{ew.entity.userName}</if>
                    <if test="ew.entity.delaysHours!=null">AND DELAYS_HOURS=#{ew.entity.delaysHours}</if>
                    <if test="ew.entity.averageHours!=null">AND AVERAGE_HOURS=#{ew.entity.averageHours}</if>
                    <if test="ew.entity.temporaryHours!=null">AND TEMPORARY_HOURS=#{ew.entity.temporaryHours}</if>
                    <if test="ew.entity.newProductHours!=null">AND NEW_PRODUCT_HOURS=#{ew.entity.newProductHours}</if>
                    <if test="ew.entity.repairHours!=null">AND REPAIR_HOURS=#{ew.entity.repairHours}</if>
                    <if test="ew.entity.workContactHours!=null">AND WORK_CONTACT_HOURS=#{ew.entity.workContactHours}
                    </if>
                    <if test="ew.entity.qualityReworkHours!=null">AND
                        QUALITY_REWORK_HOURS=#{ew.entity.qualityReworkHours}
                    </if>
                    <if test="ew.entity.normalHours!=null">AND NORMAL_HOURS=#{ew.entity.normalHours}</if>
                    <if test="ew.entity.totalHours!=null">AND TOTAL_HOURS=#{ew.entity.totalHours}</if>
                    <if test="ew.entity.standardHours!=null">AND STANDARD_HOURS=#{ew.entity.standardHours}</if>
                    <if test="ew.entity.overtimeHours!=null">AND OVERTIME_HOURS=#{ew.entity.overtimeHours}</if>
                    <if test="ew.entity.monthDays!=null">AND MONTH_DAYS=#{ew.entity.monthDays}</if>
                    <if test="ew.entity.otherOne!=null">AND OTHER_ONE=#{ew.entity.otherOne}</if>
                    <if test="ew.entity.otherTwo!=null">AND OTHER_TWO=#{ew.entity.otherTwo}</if>
                    <if test="ew.entity.createdBy!=null">AND CREATED_BY=#{ew.entity.createdBy}</if>
                    <if test="ew.entity.createdTime!=null">AND CREATED_TIME=#{ew.entity.createdTime}</if>
                    <if test="ew.entity.updatedBy!=null">AND UPDATED_BY=#{ew.entity.updatedBy}</if>
                    <if test="ew.entity.updatedTime!=null">AND UPDATED_TIME=#{ew.entity.updatedTime}</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_WORK_HOUR_STATISTICS
        <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.workCenterDescription!=null">AND
                        WORK_CENTER_DESCRIPTION=#{ew.entity.workCenterDescription}
                    </if>
                    <if test="ew.entity.jobs!=null">AND JOBS=#{ew.entity.jobs}</if>
                    <if test="ew.entity.userName!=null">AND USER_NAME=#{ew.entity.userName}</if>
                    <if test="ew.entity.delaysHours!=null">AND DELAYS_HOURS=#{ew.entity.delaysHours}</if>
                    <if test="ew.entity.averageHours!=null">AND AVERAGE_HOURS=#{ew.entity.averageHours}</if>
                    <if test="ew.entity.temporaryHours!=null">AND TEMPORARY_HOURS=#{ew.entity.temporaryHours}</if>
                    <if test="ew.entity.newProductHours!=null">AND NEW_PRODUCT_HOURS=#{ew.entity.newProductHours}</if>
                    <if test="ew.entity.repairHours!=null">AND REPAIR_HOURS=#{ew.entity.repairHours}</if>
                    <if test="ew.entity.workContactHours!=null">AND WORK_CONTACT_HOURS=#{ew.entity.workContactHours}
                    </if>
                    <if test="ew.entity.qualityReworkHours!=null">AND
                        QUALITY_REWORK_HOURS=#{ew.entity.qualityReworkHours}
                    </if>
                    <if test="ew.entity.normalHours!=null">AND NORMAL_HOURS=#{ew.entity.normalHours}</if>
                    <if test="ew.entity.totalHours!=null">AND TOTAL_HOURS=#{ew.entity.totalHours}</if>
                    <if test="ew.entity.standardHours!=null">AND STANDARD_HOURS=#{ew.entity.standardHours}</if>
                    <if test="ew.entity.overtimeHours!=null">AND OVERTIME_HOURS=#{ew.entity.overtimeHours}</if>
                    <if test="ew.entity.monthDays!=null">AND MONTH_DAYS=#{ew.entity.monthDays}</if>
                    <if test="ew.entity.otherOne!=null">AND OTHER_ONE=#{ew.entity.otherOne}</if>
                    <if test="ew.entity.otherTwo!=null">AND OTHER_TWO=#{ew.entity.otherTwo}</if>
                    <if test="ew.entity.createdBy!=null">AND CREATED_BY=#{ew.entity.createdBy}</if>
                    <if test="ew.entity.createdTime!=null">AND CREATED_TIME=#{ew.entity.createdTime}</if>
                    <if test="ew.entity.updatedBy!=null">AND UPDATED_BY=#{ew.entity.updatedBy}</if>
                    <if test="ew.entity.updatedTime!=null">AND UPDATED_TIME=#{ew.entity.updatedTime}</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_WORK_HOUR_STATISTICS
        <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.workCenterDescription!=null">AND
                        WORK_CENTER_DESCRIPTION=#{ew.entity.workCenterDescription}
                    </if>
                    <if test="ew.entity.jobs!=null">AND JOBS=#{ew.entity.jobs}</if>
                    <if test="ew.entity.userName!=null">AND USER_NAME=#{ew.entity.userName}</if>
                    <if test="ew.entity.delaysHours!=null">AND DELAYS_HOURS=#{ew.entity.delaysHours}</if>
                    <if test="ew.entity.averageHours!=null">AND AVERAGE_HOURS=#{ew.entity.averageHours}</if>
                    <if test="ew.entity.temporaryHours!=null">AND TEMPORARY_HOURS=#{ew.entity.temporaryHours}</if>
                    <if test="ew.entity.newProductHours!=null">AND NEW_PRODUCT_HOURS=#{ew.entity.newProductHours}</if>
                    <if test="ew.entity.repairHours!=null">AND REPAIR_HOURS=#{ew.entity.repairHours}</if>
                    <if test="ew.entity.workContactHours!=null">AND WORK_CONTACT_HOURS=#{ew.entity.workContactHours}
                    </if>
                    <if test="ew.entity.qualityReworkHours!=null">AND
                        QUALITY_REWORK_HOURS=#{ew.entity.qualityReworkHours}
                    </if>
                    <if test="ew.entity.normalHours!=null">AND NORMAL_HOURS=#{ew.entity.normalHours}</if>
                    <if test="ew.entity.totalHours!=null">AND TOTAL_HOURS=#{ew.entity.totalHours}</if>
                    <if test="ew.entity.standardHours!=null">AND STANDARD_HOURS=#{ew.entity.standardHours}</if>
                    <if test="ew.entity.overtimeHours!=null">AND OVERTIME_HOURS=#{ew.entity.overtimeHours}</if>
                    <if test="ew.entity.monthDays!=null">AND MONTH_DAYS=#{ew.entity.monthDays}</if>
                    <if test="ew.entity.otherOne!=null">AND OTHER_ONE=#{ew.entity.otherOne}</if>
                    <if test="ew.entity.otherTwo!=null">AND OTHER_TWO=#{ew.entity.otherTwo}</if>
                    <if test="ew.entity.createdBy!=null">AND CREATED_BY=#{ew.entity.createdBy}</if>
                    <if test="ew.entity.createdTime!=null">AND CREATED_TIME=#{ew.entity.createdTime}</if>
                    <if test="ew.entity.updatedBy!=null">AND UPDATED_BY=#{ew.entity.updatedBy}</if>
                    <if test="ew.entity.updatedTime!=null">AND UPDATED_TIME=#{ew.entity.updatedTime}</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.WorkHourStatistics">
        INSERT INTO Z_WORK_HOUR_STATISTICS
        <trim prefix="(" suffix=")" suffixOverrides=",">
            HANDLE,
            <if test="site!=null">SITE,</if>
            <if test="workCenterDescription!=null">WORK_CENTER_DESCRIPTION,</if>
            <if test="jobs!=null">JOBS,</if>
            <if test="userName!=null">USER_NAME,</if>
            <if test="delaysHours!=null">DELAYS_HOURS,</if>
            <if test="averageHours!=null">AVERAGE_HOURS,</if>
            <if test="temporaryHours!=null">TEMPORARY_HOURS,</if>
            <if test="newProductHours!=null">NEW_PRODUCT_HOURS,</if>
            <if test="repairHours!=null">REPAIR_HOURS,</if>
            <if test="workContactHours!=null">WORK_CONTACT_HOURS,</if>
            <if test="qualityReworkHours!=null">QUALITY_REWORK_HOURS,</if>
            <if test="normalHours!=null">NORMAL_HOURS,</if>
            <if test="totalHours!=null">TOTAL_HOURS,</if>
            <if test="standardHours!=null">STANDARD_HOURS,</if>
            <if test="overtimeHours!=null">OVERTIME_HOURS,</if>
            <if test="monthDays!=null">MONTH_DAYS,</if>
            <if test="otherOne!=null">OTHER_ONE,</if>
            <if test="otherTwo!=null">OTHER_TWO,</if>
            <if test="createdBy!=null">CREATED_BY,</if>
            <if test="createdTime!=null">CREATED_TIME,</if>
            <if test="updatedBy!=null">UPDATED_BY,</if>
            <if test="updatedTime!=null">UPDATED_TIME,</if>
        </trim>
        VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            <if test="site!=null">#{site},</if>
            <if test="workCenterDescription!=null">#{workCenterDescription},</if>
            <if test="jobs!=null">#{jobs},</if>
            <if test="userName!=null">#{userName},</if>
            <if test="delaysHours!=null">#{delaysHours},</if>
            <if test="averageHours!=null">#{averageHours},</if>
            <if test="temporaryHours!=null">#{temporaryHours},</if>
            <if test="newProductHours!=null">#{newProductHours},</if>
            <if test="repairHours!=null">#{repairHours},</if>
            <if test="workContactHours!=null">#{workContactHours},</if>
            <if test="qualityReworkHours!=null">#{qualityReworkHours},</if>
            <if test="normalHours!=null">#{normalHours},</if>
            <if test="totalHours!=null">#{totalHours},</if>
            <if test="standardHours!=null">#{standardHours},</if>
            <if test="overtimeHours!=null">#{overtimeHours},</if>
            <if test="monthDays!=null">#{monthDays},</if>
            <if test="otherOne!=null">#{otherOne},</if>
            <if test="otherTwo!=null">#{otherTwo},</if>
            <if test="createdBy!=null">#{createdBy},</if>
            <if test="createdTime!=null">#{createdTime},</if>
            <if test="updatedBy!=null">#{updatedBy},</if>
            <if test="updatedTime!=null">#{updatedTime},</if>
        </trim>
    </insert>

    <insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.anomaly.model.WorkHourStatistics">
        INSERT INTO Z_WORK_HOUR_STATISTICS
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <include refid="Base_Column_List"></include>
        </trim>
        VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            #{site},
            #{workCenterDescription},
            #{jobs},
            #{userName},
            #{delaysHours},
            #{averageHours},
            #{temporaryHours},
            #{newProductHours},
            #{repairHours},
            #{workContactHours},
            #{qualityReworkHours},
            #{normalHours},
            #{totalHours},
            #{standardHours},
            #{overtimeHours},
            #{monthDays},
            #{otherOne},
            #{otherTwo},
            #{createdBy},
            #{createdTime},
            #{updatedBy},
            #{updatedTime},
        </trim>
    </insert>


    <update id="updateById">
        UPDATE Z_WORK_HOUR_STATISTICS
        <trim prefix="SET" suffixOverrides=",">
            <if test="et.site!=null">SITE=#{et.site},</if>
            <if test="et.workCenterDescription!=null">WORK_CENTER_DESCRIPTION=#{et.workCenterDescription},</if>
            <if test="et.jobs!=null">JOBS=#{et.jobs},</if>
            <if test="et.userName!=null">USER_NAME=#{et.userName},</if>
            <if test="et.delaysHours!=null">DELAYS_HOURS=#{et.delaysHours},</if>
            <if test="et.averageHours!=null">AVERAGE_HOURS=#{et.averageHours},</if>
            <if test="et.temporaryHours!=null">TEMPORARY_HOURS=#{et.temporaryHours},</if>
            <if test="et.newProductHours!=null">NEW_PRODUCT_HOURS=#{et.newProductHours},</if>
            <if test="et.repairHours!=null">REPAIR_HOURS=#{et.repairHours},</if>
            <if test="et.workContactHours!=null">WORK_CONTACT_HOURS=#{et.workContactHours},</if>
            <if test="et.qualityReworkHours!=null">QUALITY_REWORK_HOURS=#{et.qualityReworkHours},</if>
            <if test="et.normalHours!=null">NORMAL_HOURS=#{et.normalHours},</if>
            <if test="et.totalHours!=null">TOTAL_HOURS=#{et.totalHours},</if>
            <if test="et.standardHours!=null">STANDARD_HOURS=#{et.standardHours},</if>
            <if test="et.overtimeHours!=null">OVERTIME_HOURS=#{et.overtimeHours},</if>
            <if test="et.monthDays!=null">MONTH_DAYS=#{et.monthDays},</if>
            <if test="et.otherOne!=null">OTHER_ONE=#{et.otherOne},</if>
            <if test="et.otherTwo!=null">OTHER_TWO=#{et.otherTwo},</if>
            <if test="et.createdBy!=null">CREATED_BY=#{et.createdBy},</if>
            <if test="et.createdTime!=null">CREATED_TIME=#{et.createdTime},</if>
            <if test="et.updatedBy!=null">UPDATED_BY=#{et.updatedBy},</if>
            <if test="et.updatedTime!=null">UPDATED_TIME=#{et.updatedTime},</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_WORK_HOUR_STATISTICS <trim prefix="SET" suffixOverrides=",">
        SITE=#{et.site},
        WORK_CENTER_DESCRIPTION=#{et.workCenterDescription},
        JOBS=#{et.jobs},
        USER_NAME=#{et.userName},
        DELAYS_HOURS=#{et.delaysHours},
        AVERAGE_HOURS=#{et.averageHours},
        TEMPORARY_HOURS=#{et.temporaryHours},
        NEW_PRODUCT_HOURS=#{et.newProductHours},
        REPAIR_HOURS=#{et.repairHours},
        WORK_CONTACT_HOURS=#{et.workContactHours},
        QUALITY_REWORK_HOURS=#{et.qualityReworkHours},
        NORMAL_HOURS=#{et.normalHours},
        TOTAL_HOURS=#{et.totalHours},
        STANDARD_HOURS=#{et.standardHours},
        OVERTIME_HOURS=#{et.overtimeHours},
        MONTH_DAYS=#{et.monthDays},
        OTHER_ONE=#{et.otherOne},
        OTHER_TWO=#{et.otherTwo},
        CREATED_BY=#{et.createdBy},
        CREATED_TIME=#{et.createdTime},
        UPDATED_BY=#{et.updatedBy},
        UPDATED_TIME=#{et.updatedTime},
    </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_WORK_HOUR_STATISTICS
        <trim prefix="SET" suffixOverrides=",">
            <if test="et.site!=null">SITE=#{et.site},</if>
            <if test="et.workCenterDescription!=null">WORK_CENTER_DESCRIPTION=#{et.workCenterDescription},</if>
            <if test="et.jobs!=null">JOBS=#{et.jobs},</if>
            <if test="et.userName!=null">USER_NAME=#{et.userName},</if>
            <if test="et.delaysHours!=null">DELAYS_HOURS=#{et.delaysHours},</if>
            <if test="et.averageHours!=null">AVERAGE_HOURS=#{et.averageHours},</if>
            <if test="et.temporaryHours!=null">TEMPORARY_HOURS=#{et.temporaryHours},</if>
            <if test="et.newProductHours!=null">NEW_PRODUCT_HOURS=#{et.newProductHours},</if>
            <if test="et.repairHours!=null">REPAIR_HOURS=#{et.repairHours},</if>
            <if test="et.workContactHours!=null">WORK_CONTACT_HOURS=#{et.workContactHours},</if>
            <if test="et.qualityReworkHours!=null">QUALITY_REWORK_HOURS=#{et.qualityReworkHours},</if>
            <if test="et.normalHours!=null">NORMAL_HOURS=#{et.normalHours},</if>
            <if test="et.totalHours!=null">TOTAL_HOURS=#{et.totalHours},</if>
            <if test="et.standardHours!=null">STANDARD_HOURS=#{et.standardHours},</if>
            <if test="et.overtimeHours!=null">OVERTIME_HOURS=#{et.overtimeHours},</if>
            <if test="et.monthDays!=null">MONTH_DAYS=#{et.monthDays},</if>
            <if test="et.otherOne!=null">OTHER_ONE=#{et.otherOne},</if>
            <if test="et.otherTwo!=null">OTHER_TWO=#{et.otherTwo},</if>
            <if test="et.createdBy!=null">CREATED_BY=#{et.createdBy},</if>
            <if test="et.createdTime!=null">CREATED_TIME=#{et.createdTime},</if>
            <if test="et.updatedBy!=null">UPDATED_BY=#{et.updatedBy},</if>
            <if test="et.updatedTime!=null">UPDATED_TIME=#{et.updatedTime},</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.workCenterDescription!=null">AND
                        WORK_CENTER_DESCRIPTION=#{ew.entity.workCenterDescription}
                    </if>
                    <if test="ew.entity.jobs!=null">AND JOBS=#{ew.entity.jobs}</if>
                    <if test="ew.entity.userName!=null">AND USER_NAME=#{ew.entity.userName}</if>
                    <if test="ew.entity.delaysHours!=null">AND DELAYS_HOURS=#{ew.entity.delaysHours}</if>
                    <if test="ew.entity.averageHours!=null">AND AVERAGE_HOURS=#{ew.entity.averageHours}</if>
                    <if test="ew.entity.temporaryHours!=null">AND TEMPORARY_HOURS=#{ew.entity.temporaryHours}</if>
                    <if test="ew.entity.newProductHours!=null">AND NEW_PRODUCT_HOURS=#{ew.entity.newProductHours}</if>
                    <if test="ew.entity.repairHours!=null">AND REPAIR_HOURS=#{ew.entity.repairHours}</if>
                    <if test="ew.entity.workContactHours!=null">AND WORK_CONTACT_HOURS=#{ew.entity.workContactHours}
                    </if>
                    <if test="ew.entity.qualityReworkHours!=null">AND
                        QUALITY_REWORK_HOURS=#{ew.entity.qualityReworkHours}
                    </if>
                    <if test="ew.entity.normalHours!=null">AND NORMAL_HOURS=#{ew.entity.normalHours}</if>
                    <if test="ew.entity.totalHours!=null">AND TOTAL_HOURS=#{ew.entity.totalHours}</if>
                    <if test="ew.entity.standardHours!=null">AND STANDARD_HOURS=#{ew.entity.standardHours}</if>
                    <if test="ew.entity.overtimeHours!=null">AND OVERTIME_HOURS=#{ew.entity.overtimeHours}</if>
                    <if test="ew.entity.monthDays!=null">AND MONTH_DAYS=#{ew.entity.monthDays}</if>
                    <if test="ew.entity.otherOne!=null">AND OTHER_ONE=#{ew.entity.otherOne}</if>
                    <if test="ew.entity.otherTwo!=null">AND OTHER_TWO=#{ew.entity.otherTwo}</if>
                    <if test="ew.entity.createdBy!=null">AND CREATED_BY=#{ew.entity.createdBy}</if>
                    <if test="ew.entity.createdTime!=null">AND CREATED_TIME=#{ew.entity.createdTime}</if>
                    <if test="ew.entity.updatedBy!=null">AND UPDATED_BY=#{ew.entity.updatedBy}</if>
                    <if test="ew.entity.updatedTime!=null">AND UPDATED_TIME=#{ew.entity.updatedTime}</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_WORK_HOUR_STATISTICS WHERE HANDLE=#{handle}
    </delete>

    <delete id="deleteByMap">
        DELETE FROM Z_WORK_HOUR_STATISTICS
        <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_WORK_HOUR_STATISTICS
        <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.workCenterDescription!=null">AND
                        WORK_CENTER_DESCRIPTION=#{ew.entity.workCenterDescription}
                    </if>
                    <if test="ew.entity.jobs!=null">AND JOBS=#{ew.entity.jobs}</if>
                    <if test="ew.entity.userName!=null">AND USER_NAME=#{ew.entity.userName}</if>
                    <if test="ew.entity.delaysHours!=null">AND DELAYS_HOURS=#{ew.entity.delaysHours}</if>
                    <if test="ew.entity.averageHours!=null">AND AVERAGE_HOURS=#{ew.entity.averageHours}</if>
                    <if test="ew.entity.temporaryHours!=null">AND TEMPORARY_HOURS=#{ew.entity.temporaryHours}</if>
                    <if test="ew.entity.newProductHours!=null">AND NEW_PRODUCT_HOURS=#{ew.entity.newProductHours}</if>
                    <if test="ew.entity.repairHours!=null">AND REPAIR_HOURS=#{ew.entity.repairHours}</if>
                    <if test="ew.entity.workContactHours!=null">AND WORK_CONTACT_HOURS=#{ew.entity.workContactHours}
                    </if>
                    <if test="ew.entity.qualityReworkHours!=null">AND
                        QUALITY_REWORK_HOURS=#{ew.entity.qualityReworkHours}
                    </if>
                    <if test="ew.entity.normalHours!=null">AND NORMAL_HOURS=#{ew.entity.normalHours}</if>
                    <if test="ew.entity.totalHours!=null">AND TOTAL_HOURS=#{ew.entity.totalHours}</if>
                    <if test="ew.entity.standardHours!=null">AND STANDARD_HOURS=#{ew.entity.standardHours}</if>
                    <if test="ew.entity.overtimeHours!=null">AND OVERTIME_HOURS=#{ew.entity.overtimeHours}</if>
                    <if test="ew.entity.monthDays!=null">AND MONTH_DAYS=#{ew.entity.monthDays}</if>
                    <if test="ew.entity.otherOne!=null">AND OTHER_ONE=#{ew.entity.otherOne}</if>
                    <if test="ew.entity.otherTwo!=null">AND OTHER_TWO=#{ew.entity.otherTwo}</if>
                    <if test="ew.entity.createdBy!=null">AND CREATED_BY=#{ew.entity.createdBy}</if>
                    <if test="ew.entity.createdTime!=null">AND CREATED_TIME=#{ew.entity.createdTime}</if>
                    <if test="ew.entity.updatedBy!=null">AND UPDATED_BY=#{ew.entity.updatedBy}</if>
                    <if test="ew.entity.updatedTime!=null">AND UPDATED_TIME=#{ew.entity.updatedTime}</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_WORK_HOUR_STATISTICS WHERE HANDLE IN (
        <foreach item="item" index="index" collection="coll" separator=",">#{item}
        </foreach>)
    </delete>
    <!-- BaseMapper标准查询/修改/删除 -->

</mapper>