<?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.listener.mapper.UsrMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.foreverwin.mesnac.listener.model.Usr">
        <id column="HANDLE" property="handle" />
        <result column="CHANGE_STAMP" property="changeStamp" />
        <result column="SITE" property="site" />
        <result column="USER_ID" property="userId" />
        <result column="FULL_NAME" property="fullName" />
        <result column="CURRENT_OPERATION_BO" property="currentOperationBo" />
        <result column="CURRENT_RESOURCE_BO" property="currentResourceBo" />
        <result column="CREATED_DATE_TIME" property="createdDateTime" />
        <result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
        <result column="BADGE_NUMBER" property="badgeNumber" />
        <result column="EMPLOYEE_NUMBER" property="employeeNumber" />
        <result column="HIRE_DATE" property="hireDate" />
        <result column="TERMINATION_DATE" property="terminationDate" />
        <result column="ALLOW_CLOCK_IN_NON_PROD" property="allowClockInNonProd" />
        <result column="ACTION_CLOCK_OUT_SFC" property="actionClockOutSfc" />
        <result column="CLOCK_IN_OUT_RANGE" property="clockInOutRange" />
        <result column="ALLOW_SUP_TIME_EDIT_APPR" property="allowSupTimeEditAppr" />
        <result column="APPR_REQ_FOR_EXPORT" property="apprReqForExport" />
        <result column="AUTO_CLOCK_OUT" property="autoClockOut" />
        <result column="CLOCK_IN_CONTROL" property="clockInControl" />
        <result column="DEFAULT_WORK_CENTER_BO" property="defaultWorkCenterBo" />
        <result column="ERP_PERSONNEL_NUMBER" property="erpPersonnelNumber" />
        <result column="ERP_USER" property="erpUser" />
    </resultMap>

    <resultMap id="usrDto" type="com.foreverwin.mesnac.common.dto.UsrDto">
        <result column="USER_NAME" property="userName"/>
        <result column="FULL_NAME" property="fullName"/>
    </resultMap>


    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        HANDLE, CHANGE_STAMP, SITE, USER_ID, CURRENT_OPERATION_BO, CURRENT_RESOURCE_BO, CREATED_DATE_TIME, MODIFIED_DATE_TIME, BADGE_NUMBER, EMPLOYEE_NUMBER, HIRE_DATE, TERMINATION_DATE, ALLOW_CLOCK_IN_NON_PROD, ACTION_CLOCK_OUT_SFC, CLOCK_IN_OUT_RANGE, ALLOW_SUP_TIME_EDIT_APPR, APPR_REQ_FOR_EXPORT, AUTO_CLOCK_OUT, CLOCK_IN_CONTROL, DEFAULT_WORK_CENTER_BO, ERP_PERSONNEL_NUMBER, ERP_USER
    </sql>

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

    <select id="selectByMap" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include>
        FROM USR
        <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 USR 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 USR
        <where>
            <if test="ew.handle!=null">
              HANDLE=#{ew.handle}
            </if>
            <if test="ew.changeStamp!=null"> AND CHANGE_STAMP=#{ew.changeStamp}</if>
            <if test="ew.site!=null"> AND SITE=#{ew.site}</if>
            <if test="ew.userId!=null"> AND USER_ID=#{ew.userId}</if>
            <if test="ew.currentOperationBo!=null"> AND CURRENT_OPERATION_BO=#{ew.currentOperationBo}</if>
            <if test="ew.currentResourceBo!=null"> AND CURRENT_RESOURCE_BO=#{ew.currentResourceBo}</if>
            <if test="ew.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.createdDateTime}</if>
            <if test="ew.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.modifiedDateTime}</if>
            <if test="ew.badgeNumber!=null"> AND BADGE_NUMBER=#{ew.badgeNumber}</if>
            <if test="ew.employeeNumber!=null"> AND EMPLOYEE_NUMBER=#{ew.employeeNumber}</if>
            <if test="ew.hireDate!=null"> AND HIRE_DATE=#{ew.hireDate}</if>
            <if test="ew.terminationDate!=null"> AND TERMINATION_DATE=#{ew.terminationDate}</if>
            <if test="ew.allowClockInNonProd!=null"> AND ALLOW_CLOCK_IN_NON_PROD=#{ew.allowClockInNonProd}</if>
            <if test="ew.actionClockOutSfc!=null"> AND ACTION_CLOCK_OUT_SFC=#{ew.actionClockOutSfc}</if>
            <if test="ew.clockInOutRange!=null"> AND CLOCK_IN_OUT_RANGE=#{ew.clockInOutRange}</if>
            <if test="ew.allowSupTimeEditAppr!=null"> AND ALLOW_SUP_TIME_EDIT_APPR=#{ew.allowSupTimeEditAppr}</if>
            <if test="ew.apprReqForExport!=null"> AND APPR_REQ_FOR_EXPORT=#{ew.apprReqForExport}</if>
            <if test="ew.autoClockOut!=null"> AND AUTO_CLOCK_OUT=#{ew.autoClockOut}</if>
            <if test="ew.clockInControl!=null"> AND CLOCK_IN_CONTROL=#{ew.clockInControl}</if>
            <if test="ew.defaultWorkCenterBo!=null"> AND DEFAULT_WORK_CENTER_BO=#{ew.defaultWorkCenterBo}</if>
            <if test="ew.erpPersonnelNumber!=null"> AND ERP_PERSONNEL_NUMBER=#{ew.erpPersonnelNumber}</if>
            <if test="ew.erpUser!=null"> AND ERP_USER=#{ew.erpUser}</if>
        </where>
    </select>

    <select id="selectCount" resultType="Integer">
        SELECT COUNT(1) FROM USR
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                <if test="ew.entity.handle!=null">
                    HANDLE=#{ew.entity.handle}
                </if>
                <if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
                <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                <if test="ew.entity.userId!=null"> AND USER_ID=#{ew.entity.userId}</if>
                <if test="ew.entity.currentOperationBo!=null"> AND CURRENT_OPERATION_BO=#{ew.entity.currentOperationBo}</if>
                <if test="ew.entity.currentResourceBo!=null"> AND CURRENT_RESOURCE_BO=#{ew.entity.currentResourceBo}</if>
                <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                <if test="ew.entity.badgeNumber!=null"> AND BADGE_NUMBER=#{ew.entity.badgeNumber}</if>
                <if test="ew.entity.employeeNumber!=null"> AND EMPLOYEE_NUMBER=#{ew.entity.employeeNumber}</if>
                <if test="ew.entity.hireDate!=null"> AND HIRE_DATE=#{ew.entity.hireDate}</if>
                <if test="ew.entity.terminationDate!=null"> AND TERMINATION_DATE=#{ew.entity.terminationDate}</if>
                <if test="ew.entity.allowClockInNonProd!=null"> AND ALLOW_CLOCK_IN_NON_PROD=#{ew.entity.allowClockInNonProd}</if>
                <if test="ew.entity.actionClockOutSfc!=null"> AND ACTION_CLOCK_OUT_SFC=#{ew.entity.actionClockOutSfc}</if>
                <if test="ew.entity.clockInOutRange!=null"> AND CLOCK_IN_OUT_RANGE=#{ew.entity.clockInOutRange}</if>
                <if test="ew.entity.allowSupTimeEditAppr!=null"> AND ALLOW_SUP_TIME_EDIT_APPR=#{ew.entity.allowSupTimeEditAppr}</if>
                <if test="ew.entity.apprReqForExport!=null"> AND APPR_REQ_FOR_EXPORT=#{ew.entity.apprReqForExport}</if>
                <if test="ew.entity.autoClockOut!=null"> AND AUTO_CLOCK_OUT=#{ew.entity.autoClockOut}</if>
                <if test="ew.entity.clockInControl!=null"> AND CLOCK_IN_CONTROL=#{ew.entity.clockInControl}</if>
                <if test="ew.entity.defaultWorkCenterBo!=null"> AND DEFAULT_WORK_CENTER_BO=#{ew.entity.defaultWorkCenterBo}</if>
                <if test="ew.entity.erpPersonnelNumber!=null"> AND ERP_PERSONNEL_NUMBER=#{ew.entity.erpPersonnelNumber}</if>
                <if test="ew.entity.erpUser!=null"> AND ERP_USER=#{ew.entity.erpUser}</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 USR
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.userId!=null"> AND USER_ID=#{ew.entity.userId}</if>
                    <if test="ew.entity.currentOperationBo!=null"> AND CURRENT_OPERATION_BO=#{ew.entity.currentOperationBo}</if>
                    <if test="ew.entity.currentResourceBo!=null"> AND CURRENT_RESOURCE_BO=#{ew.entity.currentResourceBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.badgeNumber!=null"> AND BADGE_NUMBER=#{ew.entity.badgeNumber}</if>
                    <if test="ew.entity.employeeNumber!=null"> AND EMPLOYEE_NUMBER=#{ew.entity.employeeNumber}</if>
                    <if test="ew.entity.hireDate!=null"> AND HIRE_DATE=#{ew.entity.hireDate}</if>
                    <if test="ew.entity.terminationDate!=null"> AND TERMINATION_DATE=#{ew.entity.terminationDate}</if>
                    <if test="ew.entity.allowClockInNonProd!=null"> AND ALLOW_CLOCK_IN_NON_PROD=#{ew.entity.allowClockInNonProd}</if>
                    <if test="ew.entity.actionClockOutSfc!=null"> AND ACTION_CLOCK_OUT_SFC=#{ew.entity.actionClockOutSfc}</if>
                    <if test="ew.entity.clockInOutRange!=null"> AND CLOCK_IN_OUT_RANGE=#{ew.entity.clockInOutRange}</if>
                    <if test="ew.entity.allowSupTimeEditAppr!=null"> AND ALLOW_SUP_TIME_EDIT_APPR=#{ew.entity.allowSupTimeEditAppr}</if>
                    <if test="ew.entity.apprReqForExport!=null"> AND APPR_REQ_FOR_EXPORT=#{ew.entity.apprReqForExport}</if>
                    <if test="ew.entity.autoClockOut!=null"> AND AUTO_CLOCK_OUT=#{ew.entity.autoClockOut}</if>
                    <if test="ew.entity.clockInControl!=null"> AND CLOCK_IN_CONTROL=#{ew.entity.clockInControl}</if>
                    <if test="ew.entity.defaultWorkCenterBo!=null"> AND DEFAULT_WORK_CENTER_BO=#{ew.entity.defaultWorkCenterBo}</if>
                    <if test="ew.entity.erpPersonnelNumber!=null"> AND ERP_PERSONNEL_NUMBER=#{ew.entity.erpPersonnelNumber}</if>
                    <if test="ew.entity.erpUser!=null"> AND ERP_USER=#{ew.entity.erpUser}</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="userList" resultMap="BaseResultMap">
      SELECT USR.USER_ID,ZNU.FULL_NAME FROM USR
      LEFT JOIN Z_NWA_USER ZNU ON USR.USER_ID = ZNU.USER_NAME
      WHERE USR.SITE=#{site} AND (USR.USER_ID=#{userId} OR #{userId} = NULL)

    </select>-->
    <select id="selectListForPd" resultMap="BaseResultMap">
        SELECT U.*, NU.FULL_NAME
        FROM (SELECT RESPONSIBLE_USER_BO AS USER_ID,SITE FROM Z_STORAGE_BIN WHERE STATUS ='Y' AND RESPONSIBLE_USER_BO !='' GROUP BY RESPONSIBLE_USER_BO,SITE) U
        INNER JOIN Z_NWA_USER NU
        ON U.USER_ID = NU.USER_NAME
        WHERE U.SITE = #{site}
        ORDER BY U.USER_ID
    </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 USR
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.userId!=null"> AND USER_ID=#{ew.entity.userId}</if>
                    <if test="ew.entity.currentOperationBo!=null"> AND CURRENT_OPERATION_BO=#{ew.entity.currentOperationBo}</if>
                    <if test="ew.entity.currentResourceBo!=null"> AND CURRENT_RESOURCE_BO=#{ew.entity.currentResourceBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.badgeNumber!=null"> AND BADGE_NUMBER=#{ew.entity.badgeNumber}</if>
                    <if test="ew.entity.employeeNumber!=null"> AND EMPLOYEE_NUMBER=#{ew.entity.employeeNumber}</if>
                    <if test="ew.entity.hireDate!=null"> AND HIRE_DATE=#{ew.entity.hireDate}</if>
                    <if test="ew.entity.terminationDate!=null"> AND TERMINATION_DATE=#{ew.entity.terminationDate}</if>
                    <if test="ew.entity.allowClockInNonProd!=null"> AND ALLOW_CLOCK_IN_NON_PROD=#{ew.entity.allowClockInNonProd}</if>
                    <if test="ew.entity.actionClockOutSfc!=null"> AND ACTION_CLOCK_OUT_SFC=#{ew.entity.actionClockOutSfc}</if>
                    <if test="ew.entity.clockInOutRange!=null"> AND CLOCK_IN_OUT_RANGE=#{ew.entity.clockInOutRange}</if>
                    <if test="ew.entity.allowSupTimeEditAppr!=null"> AND ALLOW_SUP_TIME_EDIT_APPR=#{ew.entity.allowSupTimeEditAppr}</if>
                    <if test="ew.entity.apprReqForExport!=null"> AND APPR_REQ_FOR_EXPORT=#{ew.entity.apprReqForExport}</if>
                    <if test="ew.entity.autoClockOut!=null"> AND AUTO_CLOCK_OUT=#{ew.entity.autoClockOut}</if>
                    <if test="ew.entity.clockInControl!=null"> AND CLOCK_IN_CONTROL=#{ew.entity.clockInControl}</if>
                    <if test="ew.entity.defaultWorkCenterBo!=null"> AND DEFAULT_WORK_CENTER_BO=#{ew.entity.defaultWorkCenterBo}</if>
                    <if test="ew.entity.erpPersonnelNumber!=null"> AND ERP_PERSONNEL_NUMBER=#{ew.entity.erpPersonnelNumber}</if>
                    <if test="ew.entity.erpUser!=null"> AND ERP_USER=#{ew.entity.erpUser}</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 USR
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.userId!=null"> AND USER_ID=#{ew.entity.userId}</if>
                    <if test="ew.entity.currentOperationBo!=null"> AND CURRENT_OPERATION_BO=#{ew.entity.currentOperationBo}</if>
                    <if test="ew.entity.currentResourceBo!=null"> AND CURRENT_RESOURCE_BO=#{ew.entity.currentResourceBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.badgeNumber!=null"> AND BADGE_NUMBER=#{ew.entity.badgeNumber}</if>
                    <if test="ew.entity.employeeNumber!=null"> AND EMPLOYEE_NUMBER=#{ew.entity.employeeNumber}</if>
                    <if test="ew.entity.hireDate!=null"> AND HIRE_DATE=#{ew.entity.hireDate}</if>
                    <if test="ew.entity.terminationDate!=null"> AND TERMINATION_DATE=#{ew.entity.terminationDate}</if>
                    <if test="ew.entity.allowClockInNonProd!=null"> AND ALLOW_CLOCK_IN_NON_PROD=#{ew.entity.allowClockInNonProd}</if>
                    <if test="ew.entity.actionClockOutSfc!=null"> AND ACTION_CLOCK_OUT_SFC=#{ew.entity.actionClockOutSfc}</if>
                    <if test="ew.entity.clockInOutRange!=null"> AND CLOCK_IN_OUT_RANGE=#{ew.entity.clockInOutRange}</if>
                    <if test="ew.entity.allowSupTimeEditAppr!=null"> AND ALLOW_SUP_TIME_EDIT_APPR=#{ew.entity.allowSupTimeEditAppr}</if>
                    <if test="ew.entity.apprReqForExport!=null"> AND APPR_REQ_FOR_EXPORT=#{ew.entity.apprReqForExport}</if>
                    <if test="ew.entity.autoClockOut!=null"> AND AUTO_CLOCK_OUT=#{ew.entity.autoClockOut}</if>
                    <if test="ew.entity.clockInControl!=null"> AND CLOCK_IN_CONTROL=#{ew.entity.clockInControl}</if>
                    <if test="ew.entity.defaultWorkCenterBo!=null"> AND DEFAULT_WORK_CENTER_BO=#{ew.entity.defaultWorkCenterBo}</if>
                    <if test="ew.entity.erpPersonnelNumber!=null"> AND ERP_PERSONNEL_NUMBER=#{ew.entity.erpPersonnelNumber}</if>
                    <if test="ew.entity.erpUser!=null"> AND ERP_USER=#{ew.entity.erpUser}</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 USR
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.userId!=null"> AND USER_ID=#{ew.entity.userId}</if>
                    <if test="ew.entity.currentOperationBo!=null"> AND CURRENT_OPERATION_BO=#{ew.entity.currentOperationBo}</if>
                    <if test="ew.entity.currentResourceBo!=null"> AND CURRENT_RESOURCE_BO=#{ew.entity.currentResourceBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.badgeNumber!=null"> AND BADGE_NUMBER=#{ew.entity.badgeNumber}</if>
                    <if test="ew.entity.employeeNumber!=null"> AND EMPLOYEE_NUMBER=#{ew.entity.employeeNumber}</if>
                    <if test="ew.entity.hireDate!=null"> AND HIRE_DATE=#{ew.entity.hireDate}</if>
                    <if test="ew.entity.terminationDate!=null"> AND TERMINATION_DATE=#{ew.entity.terminationDate}</if>
                    <if test="ew.entity.allowClockInNonProd!=null"> AND ALLOW_CLOCK_IN_NON_PROD=#{ew.entity.allowClockInNonProd}</if>
                    <if test="ew.entity.actionClockOutSfc!=null"> AND ACTION_CLOCK_OUT_SFC=#{ew.entity.actionClockOutSfc}</if>
                    <if test="ew.entity.clockInOutRange!=null"> AND CLOCK_IN_OUT_RANGE=#{ew.entity.clockInOutRange}</if>
                    <if test="ew.entity.allowSupTimeEditAppr!=null"> AND ALLOW_SUP_TIME_EDIT_APPR=#{ew.entity.allowSupTimeEditAppr}</if>
                    <if test="ew.entity.apprReqForExport!=null"> AND APPR_REQ_FOR_EXPORT=#{ew.entity.apprReqForExport}</if>
                    <if test="ew.entity.autoClockOut!=null"> AND AUTO_CLOCK_OUT=#{ew.entity.autoClockOut}</if>
                    <if test="ew.entity.clockInControl!=null"> AND CLOCK_IN_CONTROL=#{ew.entity.clockInControl}</if>
                    <if test="ew.entity.defaultWorkCenterBo!=null"> AND DEFAULT_WORK_CENTER_BO=#{ew.entity.defaultWorkCenterBo}</if>
                    <if test="ew.entity.erpPersonnelNumber!=null"> AND ERP_PERSONNEL_NUMBER=#{ew.entity.erpPersonnelNumber}</if>
                    <if test="ew.entity.erpUser!=null"> AND ERP_USER=#{ew.entity.erpUser}</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 USR
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.userId!=null"> AND USER_ID=#{ew.entity.userId}</if>
                    <if test="ew.entity.currentOperationBo!=null"> AND CURRENT_OPERATION_BO=#{ew.entity.currentOperationBo}</if>
                    <if test="ew.entity.currentResourceBo!=null"> AND CURRENT_RESOURCE_BO=#{ew.entity.currentResourceBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.badgeNumber!=null"> AND BADGE_NUMBER=#{ew.entity.badgeNumber}</if>
                    <if test="ew.entity.employeeNumber!=null"> AND EMPLOYEE_NUMBER=#{ew.entity.employeeNumber}</if>
                    <if test="ew.entity.hireDate!=null"> AND HIRE_DATE=#{ew.entity.hireDate}</if>
                    <if test="ew.entity.terminationDate!=null"> AND TERMINATION_DATE=#{ew.entity.terminationDate}</if>
                    <if test="ew.entity.allowClockInNonProd!=null"> AND ALLOW_CLOCK_IN_NON_PROD=#{ew.entity.allowClockInNonProd}</if>
                    <if test="ew.entity.actionClockOutSfc!=null"> AND ACTION_CLOCK_OUT_SFC=#{ew.entity.actionClockOutSfc}</if>
                    <if test="ew.entity.clockInOutRange!=null"> AND CLOCK_IN_OUT_RANGE=#{ew.entity.clockInOutRange}</if>
                    <if test="ew.entity.allowSupTimeEditAppr!=null"> AND ALLOW_SUP_TIME_EDIT_APPR=#{ew.entity.allowSupTimeEditAppr}</if>
                    <if test="ew.entity.apprReqForExport!=null"> AND APPR_REQ_FOR_EXPORT=#{ew.entity.apprReqForExport}</if>
                    <if test="ew.entity.autoClockOut!=null"> AND AUTO_CLOCK_OUT=#{ew.entity.autoClockOut}</if>
                    <if test="ew.entity.clockInControl!=null"> AND CLOCK_IN_CONTROL=#{ew.entity.clockInControl}</if>
                    <if test="ew.entity.defaultWorkCenterBo!=null"> AND DEFAULT_WORK_CENTER_BO=#{ew.entity.defaultWorkCenterBo}</if>
                    <if test="ew.entity.erpPersonnelNumber!=null"> AND ERP_PERSONNEL_NUMBER=#{ew.entity.erpPersonnelNumber}</if>
                    <if test="ew.entity.erpUser!=null"> AND ERP_USER=#{ew.entity.erpUser}</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.listener.model.Usr">
        INSERT INTO USR
        <trim prefix="(" suffix=")" suffixOverrides=",">
            HANDLE,
            <if test="changeStamp!=null">CHANGE_STAMP,</if>
            <if test="site!=null">SITE,</if>
            <if test="userId!=null">USER_ID,</if>
            <if test="currentOperationBo!=null">CURRENT_OPERATION_BO,</if>
            <if test="currentResourceBo!=null">CURRENT_RESOURCE_BO,</if>
            <if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
            <if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
            <if test="badgeNumber!=null">BADGE_NUMBER,</if>
            <if test="employeeNumber!=null">EMPLOYEE_NUMBER,</if>
            <if test="hireDate!=null">HIRE_DATE,</if>
            <if test="terminationDate!=null">TERMINATION_DATE,</if>
            <if test="allowClockInNonProd!=null">ALLOW_CLOCK_IN_NON_PROD,</if>
            <if test="actionClockOutSfc!=null">ACTION_CLOCK_OUT_SFC,</if>
            <if test="clockInOutRange!=null">CLOCK_IN_OUT_RANGE,</if>
            <if test="allowSupTimeEditAppr!=null">ALLOW_SUP_TIME_EDIT_APPR,</if>
            <if test="apprReqForExport!=null">APPR_REQ_FOR_EXPORT,</if>
            <if test="autoClockOut!=null">AUTO_CLOCK_OUT,</if>
            <if test="clockInControl!=null">CLOCK_IN_CONTROL,</if>
            <if test="defaultWorkCenterBo!=null">DEFAULT_WORK_CENTER_BO,</if>
            <if test="erpPersonnelNumber!=null">ERP_PERSONNEL_NUMBER,</if>
            <if test="erpUser!=null">ERP_USER,</if>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            <if test="changeStamp!=null">#{changeStamp},</if>
            <if test="site!=null">#{site},</if>
            <if test="userId!=null">#{userId},</if>
            <if test="currentOperationBo!=null">#{currentOperationBo},</if>
            <if test="currentResourceBo!=null">#{currentResourceBo},</if>
            <if test="createdDateTime!=null">#{createdDateTime},</if>
            <if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
            <if test="badgeNumber!=null">#{badgeNumber},</if>
            <if test="employeeNumber!=null">#{employeeNumber},</if>
            <if test="hireDate!=null">#{hireDate},</if>
            <if test="terminationDate!=null">#{terminationDate},</if>
            <if test="allowClockInNonProd!=null">#{allowClockInNonProd},</if>
            <if test="actionClockOutSfc!=null">#{actionClockOutSfc},</if>
            <if test="clockInOutRange!=null">#{clockInOutRange},</if>
            <if test="allowSupTimeEditAppr!=null">#{allowSupTimeEditAppr},</if>
            <if test="apprReqForExport!=null">#{apprReqForExport},</if>
            <if test="autoClockOut!=null">#{autoClockOut},</if>
            <if test="clockInControl!=null">#{clockInControl},</if>
            <if test="defaultWorkCenterBo!=null">#{defaultWorkCenterBo},</if>
            <if test="erpPersonnelNumber!=null">#{erpPersonnelNumber},</if>
            <if test="erpUser!=null">#{erpUser},</if>
        </trim>
    </insert>

    <insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.listener.model.Usr">
        INSERT INTO USR
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <include refid="Base_Column_List"></include>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            #{changeStamp},
            #{site},
            #{userId},
            #{currentOperationBo},
            #{currentResourceBo},
            #{createdDateTime},
            #{modifiedDateTime},
            #{badgeNumber},
            #{employeeNumber},
            #{hireDate},
            #{terminationDate},
            #{allowClockInNonProd},
            #{actionClockOutSfc},
            #{clockInOutRange},
            #{allowSupTimeEditAppr},
            #{apprReqForExport},
            #{autoClockOut},
            #{clockInControl},
            #{defaultWorkCenterBo},
            #{erpPersonnelNumber},
            #{erpUser},
        </trim>
    </insert>


    <update id="updateById">
        UPDATE USR <trim prefix="SET" suffixOverrides=",">
        <if test="et.changeStamp!=null">CHANGE_STAMP=#{et.changeStamp},</if>
        <if test="et.site!=null">SITE=#{et.site},</if>
        <if test="et.userId!=null">USER_ID=#{et.userId},</if>
        <if test="et.currentOperationBo!=null">CURRENT_OPERATION_BO=#{et.currentOperationBo},</if>
        <if test="et.currentResourceBo!=null">CURRENT_RESOURCE_BO=#{et.currentResourceBo},</if>
        <if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
        <if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
        <if test="et.badgeNumber!=null">BADGE_NUMBER=#{et.badgeNumber},</if>
        <if test="et.employeeNumber!=null">EMPLOYEE_NUMBER=#{et.employeeNumber},</if>
        <if test="et.hireDate!=null">HIRE_DATE=#{et.hireDate},</if>
        <if test="et.terminationDate!=null">TERMINATION_DATE=#{et.terminationDate},</if>
        <if test="et.allowClockInNonProd!=null">ALLOW_CLOCK_IN_NON_PROD=#{et.allowClockInNonProd},</if>
        <if test="et.actionClockOutSfc!=null">ACTION_CLOCK_OUT_SFC=#{et.actionClockOutSfc},</if>
        <if test="et.clockInOutRange!=null">CLOCK_IN_OUT_RANGE=#{et.clockInOutRange},</if>
        <if test="et.allowSupTimeEditAppr!=null">ALLOW_SUP_TIME_EDIT_APPR=#{et.allowSupTimeEditAppr},</if>
        <if test="et.apprReqForExport!=null">APPR_REQ_FOR_EXPORT=#{et.apprReqForExport},</if>
        <if test="et.autoClockOut!=null">AUTO_CLOCK_OUT=#{et.autoClockOut},</if>
        <if test="et.clockInControl!=null">CLOCK_IN_CONTROL=#{et.clockInControl},</if>
        <if test="et.defaultWorkCenterBo!=null">DEFAULT_WORK_CENTER_BO=#{et.defaultWorkCenterBo},</if>
        <if test="et.erpPersonnelNumber!=null">ERP_PERSONNEL_NUMBER=#{et.erpPersonnelNumber},</if>
        <if test="et.erpUser!=null">ERP_USER=#{et.erpUser},</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 USR <trim prefix="SET" suffixOverrides=",">
        CHANGE_STAMP=#{et.changeStamp},
        SITE=#{et.site},
        USER_ID=#{et.userId},
        CURRENT_OPERATION_BO=#{et.currentOperationBo},
        CURRENT_RESOURCE_BO=#{et.currentResourceBo},
        CREATED_DATE_TIME=#{et.createdDateTime},
        MODIFIED_DATE_TIME=#{et.modifiedDateTime},
        BADGE_NUMBER=#{et.badgeNumber},
        EMPLOYEE_NUMBER=#{et.employeeNumber},
        HIRE_DATE=#{et.hireDate},
        TERMINATION_DATE=#{et.terminationDate},
        ALLOW_CLOCK_IN_NON_PROD=#{et.allowClockInNonProd},
        ACTION_CLOCK_OUT_SFC=#{et.actionClockOutSfc},
        CLOCK_IN_OUT_RANGE=#{et.clockInOutRange},
        ALLOW_SUP_TIME_EDIT_APPR=#{et.allowSupTimeEditAppr},
        APPR_REQ_FOR_EXPORT=#{et.apprReqForExport},
        AUTO_CLOCK_OUT=#{et.autoClockOut},
        CLOCK_IN_CONTROL=#{et.clockInControl},
        DEFAULT_WORK_CENTER_BO=#{et.defaultWorkCenterBo},
        ERP_PERSONNEL_NUMBER=#{et.erpPersonnelNumber},
        ERP_USER=#{et.erpUser},
     </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 USR <trim prefix="SET" suffixOverrides=",">
        <if test="et.changeStamp!=null">CHANGE_STAMP=#{et.changeStamp},</if>
        <if test="et.site!=null">SITE=#{et.site},</if>
        <if test="et.userId!=null">USER_ID=#{et.userId},</if>
        <if test="et.currentOperationBo!=null">CURRENT_OPERATION_BO=#{et.currentOperationBo},</if>
        <if test="et.currentResourceBo!=null">CURRENT_RESOURCE_BO=#{et.currentResourceBo},</if>
        <if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
        <if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
        <if test="et.badgeNumber!=null">BADGE_NUMBER=#{et.badgeNumber},</if>
        <if test="et.employeeNumber!=null">EMPLOYEE_NUMBER=#{et.employeeNumber},</if>
        <if test="et.hireDate!=null">HIRE_DATE=#{et.hireDate},</if>
        <if test="et.terminationDate!=null">TERMINATION_DATE=#{et.terminationDate},</if>
        <if test="et.allowClockInNonProd!=null">ALLOW_CLOCK_IN_NON_PROD=#{et.allowClockInNonProd},</if>
        <if test="et.actionClockOutSfc!=null">ACTION_CLOCK_OUT_SFC=#{et.actionClockOutSfc},</if>
        <if test="et.clockInOutRange!=null">CLOCK_IN_OUT_RANGE=#{et.clockInOutRange},</if>
        <if test="et.allowSupTimeEditAppr!=null">ALLOW_SUP_TIME_EDIT_APPR=#{et.allowSupTimeEditAppr},</if>
        <if test="et.apprReqForExport!=null">APPR_REQ_FOR_EXPORT=#{et.apprReqForExport},</if>
        <if test="et.autoClockOut!=null">AUTO_CLOCK_OUT=#{et.autoClockOut},</if>
        <if test="et.clockInControl!=null">CLOCK_IN_CONTROL=#{et.clockInControl},</if>
        <if test="et.defaultWorkCenterBo!=null">DEFAULT_WORK_CENTER_BO=#{et.defaultWorkCenterBo},</if>
        <if test="et.erpPersonnelNumber!=null">ERP_PERSONNEL_NUMBER=#{et.erpPersonnelNumber},</if>
        <if test="et.erpUser!=null">ERP_USER=#{et.erpUser},</if>
    </trim>
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    HANDLE=#{ew.entity.handle}
                    <if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.userId!=null"> AND USER_ID=#{ew.entity.userId}</if>
                    <if test="ew.entity.currentOperationBo!=null"> AND CURRENT_OPERATION_BO=#{ew.entity.currentOperationBo}</if>
                    <if test="ew.entity.currentResourceBo!=null"> AND CURRENT_RESOURCE_BO=#{ew.entity.currentResourceBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.badgeNumber!=null"> AND BADGE_NUMBER=#{ew.entity.badgeNumber}</if>
                    <if test="ew.entity.employeeNumber!=null"> AND EMPLOYEE_NUMBER=#{ew.entity.employeeNumber}</if>
                    <if test="ew.entity.hireDate!=null"> AND HIRE_DATE=#{ew.entity.hireDate}</if>
                    <if test="ew.entity.terminationDate!=null"> AND TERMINATION_DATE=#{ew.entity.terminationDate}</if>
                    <if test="ew.entity.allowClockInNonProd!=null"> AND ALLOW_CLOCK_IN_NON_PROD=#{ew.entity.allowClockInNonProd}</if>
                    <if test="ew.entity.actionClockOutSfc!=null"> AND ACTION_CLOCK_OUT_SFC=#{ew.entity.actionClockOutSfc}</if>
                    <if test="ew.entity.clockInOutRange!=null"> AND CLOCK_IN_OUT_RANGE=#{ew.entity.clockInOutRange}</if>
                    <if test="ew.entity.allowSupTimeEditAppr!=null"> AND ALLOW_SUP_TIME_EDIT_APPR=#{ew.entity.allowSupTimeEditAppr}</if>
                    <if test="ew.entity.apprReqForExport!=null"> AND APPR_REQ_FOR_EXPORT=#{ew.entity.apprReqForExport}</if>
                    <if test="ew.entity.autoClockOut!=null"> AND AUTO_CLOCK_OUT=#{ew.entity.autoClockOut}</if>
                    <if test="ew.entity.clockInControl!=null"> AND CLOCK_IN_CONTROL=#{ew.entity.clockInControl}</if>
                    <if test="ew.entity.defaultWorkCenterBo!=null"> AND DEFAULT_WORK_CENTER_BO=#{ew.entity.defaultWorkCenterBo}</if>
                    <if test="ew.entity.erpPersonnelNumber!=null"> AND ERP_PERSONNEL_NUMBER=#{ew.entity.erpPersonnelNumber}</if>
                    <if test="ew.entity.erpUser!=null"> AND ERP_USER=#{ew.entity.erpUser}</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 USR WHERE HANDLE=#{handle}
    </delete>

    <delete id="deleteByMap">
        DELETE FROM USR
        <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 USR
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.userId!=null"> AND USER_ID=#{ew.entity.userId}</if>
                    <if test="ew.entity.currentOperationBo!=null"> AND CURRENT_OPERATION_BO=#{ew.entity.currentOperationBo}</if>
                    <if test="ew.entity.currentResourceBo!=null"> AND CURRENT_RESOURCE_BO=#{ew.entity.currentResourceBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
                    <if test="ew.entity.badgeNumber!=null"> AND BADGE_NUMBER=#{ew.entity.badgeNumber}</if>
                    <if test="ew.entity.employeeNumber!=null"> AND EMPLOYEE_NUMBER=#{ew.entity.employeeNumber}</if>
                    <if test="ew.entity.hireDate!=null"> AND HIRE_DATE=#{ew.entity.hireDate}</if>
                    <if test="ew.entity.terminationDate!=null"> AND TERMINATION_DATE=#{ew.entity.terminationDate}</if>
                    <if test="ew.entity.allowClockInNonProd!=null"> AND ALLOW_CLOCK_IN_NON_PROD=#{ew.entity.allowClockInNonProd}</if>
                    <if test="ew.entity.actionClockOutSfc!=null"> AND ACTION_CLOCK_OUT_SFC=#{ew.entity.actionClockOutSfc}</if>
                    <if test="ew.entity.clockInOutRange!=null"> AND CLOCK_IN_OUT_RANGE=#{ew.entity.clockInOutRange}</if>
                    <if test="ew.entity.allowSupTimeEditAppr!=null"> AND ALLOW_SUP_TIME_EDIT_APPR=#{ew.entity.allowSupTimeEditAppr}</if>
                    <if test="ew.entity.apprReqForExport!=null"> AND APPR_REQ_FOR_EXPORT=#{ew.entity.apprReqForExport}</if>
                    <if test="ew.entity.autoClockOut!=null"> AND AUTO_CLOCK_OUT=#{ew.entity.autoClockOut}</if>
                    <if test="ew.entity.clockInControl!=null"> AND CLOCK_IN_CONTROL=#{ew.entity.clockInControl}</if>
                    <if test="ew.entity.defaultWorkCenterBo!=null"> AND DEFAULT_WORK_CENTER_BO=#{ew.entity.defaultWorkCenterBo}</if>
                    <if test="ew.entity.erpPersonnelNumber!=null"> AND ERP_PERSONNEL_NUMBER=#{ew.entity.erpPersonnelNumber}</if>
                    <if test="ew.entity.erpUser!=null"> AND ERP_USER=#{ew.entity.erpUser}</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 USR WHERE HANDLE IN (
        <foreach item="item" index="index" collection="coll" separator=",">#{item}
        </foreach>)
    </delete>
    <!-- BaseMapper标准查询/修改/删除 -->
    <select id="findList" resultMap="usrDto">
        SELECT U.USER_ID USER_NAME,ZNU.FULL_NAME FULL_NAME
        FROM USR U
        INNER JOIN Z_NWA_USER ZNU ON ZNU.USER_NAME = U.USER_ID
        WHERE U.SITE=#{site}
        <if test="user != null and user != ''">
            AND (
            U.USER_ID = #{user}
            )
        </if>
    </select>

    <select id="findPage" resultMap="usrDto">
        SELECT U.USER_ID USER_NAME,ZNU.FULL_NAME FULL_NAME
        FROM USR U
        INNER JOIN Z_NWA_USER ZNU ON ZNU.USER_NAME = U.USER_ID
        WHERE U.SITE=#{site}
        <if test="user != null and user != ''">
            AND (
            U.USER_ID LIKE UPPER('%${user}%')
            OR ZNU.FULL_NAME LIKE UPPER('%${user}%')
            )
        </if>
    </select>
</mapper>
