<?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.dispatch.mapper.UserResourceMapper" >
<!-- 通用查询映射结果 -->
<resultMap id= "BaseResultMap" type= "com.foreverwin.mesnac.dispatch.model.UserResource" >
<id column= "HANDLE" property= "handle" />
<result column= "SITE" property= "site" />
<result column= "RESOURCE_BO" property= "resourceBo" />
<result column= "RESRCE" property= "resrce" />
<result column= "RESRCE_DESCRIPTION" property= "resrceDescription" />
<result column= "USER_ID" property= "userId" />
<result column= "USER_DESCRIPTION" property= "userDescription" />
<result column= "TEMPORARY_USER" property= "temporaryUser" />
<result column= "STATUS" property= "status" />
<result column= "CREATED_USER" property= "createdUser" />
<result column= "CREATED_DATE_TIME" property= "createdDateTime" />
<result column= "MODIFIED_USER" property= "modifiedUser" />
<result column= "MODIFIED_DATE_TIME" property= "modifiedDateTime" />
</resultMap>
<resultMap id= "UserResourceDto" type= "com.foreverwin.mesnac.dispatch.dto.UserResourceDto" extends= "BaseResultMap" >
<result column= "SEQ" property= "seq" />
<result column= "RESOURCE_DESCRIPTION" property= "resrceDescription" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id= "Base_Column_List" >
HANDLE, SITE, RESOURCE_BO, RESRCE, RESRCE_DESCRIPTION, USER_ID, USER_DESCRIPTION, TEMPORARY_USER, STATUS, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
<select id= "selectById" resultMap= "BaseResultMap" >
SELECT <include refid= "Base_Column_List" > </include> FROM Z_USER_RESOURCE WHERE HANDLE=#{handle}
</select>
<select id= "selectByMap" resultMap= "BaseResultMap" >
SELECT <include refid= "Base_Column_List" > </include>
FROM Z_USER_RESOURCE
<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_USER_RESOURCE 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_USER_RESOURCE
<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.resourceBo!=null" > AND RESOURCE_BO=#{ew.entity.resourceBo}</if>
<if test= "ew.entity.resrce!=null" > AND RESRCE=#{ew.entity.resrce}</if>
<if test= "ew.entity.resrceDescription!=null" > AND RESRCE_DESCRIPTION=#{ew.entity.resrceDescription}</if>
<if test= "ew.entity.userId!=null" > AND USER_ID=#{ew.entity.userId}</if>
<if test= "ew.entity.userDescription!=null" > AND USER_DESCRIPTION=#{ew.entity.userDescription}</if>
<if test= "ew.entity.temporaryUser!=null" > AND TEMPORARY_USER=#{ew.entity.temporaryUser}</if>
<if test= "ew.entity.status!=null" > AND STATUS=#{ew.entity.status}</if>
<if test= "ew.entity.createdUser!=null" > AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test= "ew.entity.createdDateTime!=null" > AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_USER_RESOURCE
<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.resourceBo!=null" > AND RESOURCE_BO=#{ew.entity.resourceBo}</if>
<if test= "ew.entity.resrce!=null" > AND RESRCE=#{ew.entity.resrce}</if>
<if test= "ew.entity.resrceDescription!=null" > AND RESRCE_DESCRIPTION=#{ew.entity.resrceDescription}</if>
<if test= "ew.entity.userId!=null" > AND USER_ID=#{ew.entity.userId}</if>
<if test= "ew.entity.userDescription!=null" > AND USER_DESCRIPTION=#{ew.entity.userDescription}</if>
<if test= "ew.entity.temporaryUser!=null" > AND TEMPORARY_USER=#{ew.entity.temporaryUser}</if>
<if test= "ew.entity.status!=null" > AND STATUS=#{ew.entity.status}</if>
<if test= "ew.entity.createdUser!=null" > AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test= "ew.entity.createdDateTime!=null" > AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_USER_RESOURCE
<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.resourceBo!=null" > AND RESOURCE_BO=#{ew.entity.resourceBo}</if>
<if test= "ew.entity.resrce!=null" > AND RESRCE=#{ew.entity.resrce}</if>
<if test= "ew.entity.resrceDescription!=null" > AND RESRCE_DESCRIPTION=#{ew.entity.resrceDescription}</if>
<if test= "ew.entity.userId!=null" > AND USER_ID=#{ew.entity.userId}</if>
<if test= "ew.entity.userDescription!=null" > AND USER_DESCRIPTION=#{ew.entity.userDescription}</if>
<if test= "ew.entity.temporaryUser!=null" > AND TEMPORARY_USER=#{ew.entity.temporaryUser}</if>
<if test= "ew.entity.status!=null" > AND STATUS=#{ew.entity.status}</if>
<if test= "ew.entity.createdUser!=null" > AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test= "ew.entity.createdDateTime!=null" > AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_USER_RESOURCE
<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.resourceBo!=null" > AND RESOURCE_BO=#{ew.entity.resourceBo}</if>
<if test= "ew.entity.resrce!=null" > AND RESRCE=#{ew.entity.resrce}</if>
<if test= "ew.entity.resrceDescription!=null" > AND RESRCE_DESCRIPTION=#{ew.entity.resrceDescription}</if>
<if test= "ew.entity.userId!=null" > AND USER_ID=#{ew.entity.userId}</if>
<if test= "ew.entity.userDescription!=null" > AND USER_DESCRIPTION=#{ew.entity.userDescription}</if>
<if test= "ew.entity.temporaryUser!=null" > AND TEMPORARY_USER=#{ew.entity.temporaryUser}</if>
<if test= "ew.entity.status!=null" > AND STATUS=#{ew.entity.status}</if>
<if test= "ew.entity.createdUser!=null" > AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test= "ew.entity.createdDateTime!=null" > AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_USER_RESOURCE
<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.resourceBo!=null" > AND RESOURCE_BO=#{ew.entity.resourceBo}</if>
<if test= "ew.entity.resrce!=null" > AND RESRCE=#{ew.entity.resrce}</if>
<if test= "ew.entity.resrceDescription!=null" > AND RESRCE_DESCRIPTION=#{ew.entity.resrceDescription}</if>
<if test= "ew.entity.userId!=null" > AND USER_ID=#{ew.entity.userId}</if>
<if test= "ew.entity.userDescription!=null" > AND USER_DESCRIPTION=#{ew.entity.userDescription}</if>
<if test= "ew.entity.temporaryUser!=null" > AND TEMPORARY_USER=#{ew.entity.temporaryUser}</if>
<if test= "ew.entity.status!=null" > AND STATUS=#{ew.entity.status}</if>
<if test= "ew.entity.createdUser!=null" > AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test= "ew.entity.createdDateTime!=null" > AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_USER_RESOURCE
<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.resourceBo!=null" > AND RESOURCE_BO=#{ew.entity.resourceBo}</if>
<if test= "ew.entity.resrce!=null" > AND RESRCE=#{ew.entity.resrce}</if>
<if test= "ew.entity.resrceDescription!=null" > AND RESRCE_DESCRIPTION=#{ew.entity.resrceDescription}</if>
<if test= "ew.entity.userId!=null" > AND USER_ID=#{ew.entity.userId}</if>
<if test= "ew.entity.userDescription!=null" > AND USER_DESCRIPTION=#{ew.entity.userDescription}</if>
<if test= "ew.entity.temporaryUser!=null" > AND TEMPORARY_USER=#{ew.entity.temporaryUser}</if>
<if test= "ew.entity.status!=null" > AND STATUS=#{ew.entity.status}</if>
<if test= "ew.entity.createdUser!=null" > AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test= "ew.entity.createdDateTime!=null" > AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_USER_RESOURCE
<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.resourceBo!=null" > AND RESOURCE_BO=#{ew.entity.resourceBo}</if>
<if test= "ew.entity.resrce!=null" > AND RESRCE=#{ew.entity.resrce}</if>
<if test= "ew.entity.resrceDescription!=null" > AND RESRCE_DESCRIPTION=#{ew.entity.resrceDescription}</if>
<if test= "ew.entity.userId!=null" > AND USER_ID=#{ew.entity.userId}</if>
<if test= "ew.entity.userDescription!=null" > AND USER_DESCRIPTION=#{ew.entity.userDescription}</if>
<if test= "ew.entity.temporaryUser!=null" > AND TEMPORARY_USER=#{ew.entity.temporaryUser}</if>
<if test= "ew.entity.status!=null" > AND STATUS=#{ew.entity.status}</if>
<if test= "ew.entity.createdUser!=null" > AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test= "ew.entity.createdDateTime!=null" > AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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.dispatch.model.UserResource" >
INSERT INTO Z_USER_RESOURCE
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
HANDLE,
<if test= "site!=null" > SITE,</if>
<if test= "resourceBo!=null" > RESOURCE_BO,</if>
<if test= "resrce!=null" > RESRCE,</if>
<if test= "resrceDescription!=null" > RESRCE_DESCRIPTION,</if>
<if test= "userId!=null" > USER_ID,</if>
<if test= "userDescription!=null" > USER_DESCRIPTION,</if>
<if test= "temporaryUser!=null" > TEMPORARY_USER,</if>
<if test= "status!=null" > STATUS,</if>
<if test= "createdUser!=null" > CREATED_USER,</if>
<if test= "createdDateTime!=null" > CREATED_DATE_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= "resourceBo!=null" > #{resourceBo},</if>
<if test= "resrce!=null" > #{resrce},</if>
<if test= "resrceDescription!=null" > #{resrceDescription},</if>
<if test= "userId!=null" > #{userId},</if>
<if test= "userDescription!=null" > #{userDescription},</if>
<if test= "temporaryUser!=null" > #{temporaryUser},</if>
<if test= "status!=null" > #{status},</if>
<if test= "createdUser!=null" > #{createdUser},</if>
<if test= "createdDateTime!=null" > #{createdDateTime},</if>
<if test= "modifiedUser!=null" > #{modifiedUser},</if>
<if test= "modifiedDateTime!=null" > #{modifiedDateTime},</if>
</trim>
</insert>
<insert id= "insertAllColumn" parameterType= "com.foreverwin.mesnac.dispatch.model.UserResource" >
INSERT INTO Z_USER_RESOURCE
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<include refid= "Base_Column_List" > </include>
</trim> VALUES
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
#{handle},
#{site},
#{resourceBo},
#{resrce},
#{resrceDescription},
#{userId},
#{userDescription},
#{temporaryUser},
#{status},
#{createdUser},
#{createdDateTime},
#{modifiedUser},
#{modifiedDateTime},
</trim>
</insert>
<update id= "updateById" >
UPDATE Z_USER_RESOURCE <trim prefix= "SET" suffixOverrides= "," >
<if test= "et.site!=null" > SITE=#{et.site},</if>
<if test= "et.resourceBo!=null" > RESOURCE_BO=#{et.resourceBo},</if>
<if test= "et.resrce!=null" > RESRCE=#{et.resrce},</if>
<if test= "et.resrceDescription!=null" > RESRCE_DESCRIPTION=#{et.resrceDescription},</if>
<if test= "et.userId!=null" > USER_ID=#{et.userId},</if>
<if test= "et.userDescription!=null" > USER_DESCRIPTION=#{et.userDescription},</if>
<if test= "et.temporaryUser!=null" > TEMPORARY_USER=#{et.temporaryUser},</if>
<if test= "et.status!=null" > STATUS=#{et.status},</if>
<if test= "et.createdUser!=null" > CREATED_USER=#{et.createdUser},</if>
<if test= "et.createdDateTime!=null" > CREATED_DATE_TIME=#{et.createdDateTime},</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_USER_RESOURCE <trim prefix= "SET" suffixOverrides= "," >
SITE=#{et.site},
RESOURCE_BO=#{et.resourceBo},
RESRCE=#{et.resrce},
RESRCE_DESCRIPTION=#{et.resrceDescription},
USER_ID=#{et.userId},
USER_DESCRIPTION=#{et.userDescription},
TEMPORARY_USER=#{et.temporaryUser},
STATUS=#{et.status},
CREATED_USER=#{et.createdUser},
CREATED_DATE_TIME=#{et.createdDateTime},
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_USER_RESOURCE <trim prefix= "SET" suffixOverrides= "," >
<if test= "et.site!=null" > SITE=#{et.site},</if>
<if test= "et.resourceBo!=null" > RESOURCE_BO=#{et.resourceBo},</if>
<if test= "et.resrce!=null" > RESRCE=#{et.resrce},</if>
<if test= "et.resrceDescription!=null" > RESRCE_DESCRIPTION=#{et.resrceDescription},</if>
<if test= "et.userId!=null" > USER_ID=#{et.userId},</if>
<if test= "et.userDescription!=null" > USER_DESCRIPTION=#{et.userDescription},</if>
<if test= "et.temporaryUser!=null" > TEMPORARY_USER=#{et.temporaryUser},</if>
<if test= "et.status!=null" > STATUS=#{et.status},</if>
<if test= "et.createdUser!=null" > CREATED_USER=#{et.createdUser},</if>
<if test= "et.createdDateTime!=null" > CREATED_DATE_TIME=#{et.createdDateTime},</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.resourceBo!=null" > AND RESOURCE_BO=#{ew.entity.resourceBo}</if>
<if test= "ew.entity.resrce!=null" > AND RESRCE=#{ew.entity.resrce}</if>
<if test= "ew.entity.resrceDescription!=null" > AND RESRCE_DESCRIPTION=#{ew.entity.resrceDescription}</if>
<if test= "ew.entity.userId!=null" > AND USER_ID=#{ew.entity.userId}</if>
<if test= "ew.entity.userDescription!=null" > AND USER_DESCRIPTION=#{ew.entity.userDescription}</if>
<if test= "ew.entity.temporaryUser!=null" > AND TEMPORARY_USER=#{ew.entity.temporaryUser}</if>
<if test= "ew.entity.status!=null" > AND STATUS=#{ew.entity.status}</if>
<if test= "ew.entity.createdUser!=null" > AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test= "ew.entity.createdDateTime!=null" > AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_USER_RESOURCE WHERE HANDLE=#{handle}
</delete>
<delete id= "deleteByMap" >
DELETE FROM Z_USER_RESOURCE
<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_USER_RESOURCE
<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.resourceBo!=null" > AND RESOURCE_BO=#{ew.entity.resourceBo}</if>
<if test= "ew.entity.resrce!=null" > AND RESRCE=#{ew.entity.resrce}</if>
<if test= "ew.entity.resrceDescription!=null" > AND RESRCE_DESCRIPTION=#{ew.entity.resrceDescription}</if>
<if test= "ew.entity.userId!=null" > AND USER_ID=#{ew.entity.userId}</if>
<if test= "ew.entity.userDescription!=null" > AND USER_DESCRIPTION=#{ew.entity.userDescription}</if>
<if test= "ew.entity.temporaryUser!=null" > AND TEMPORARY_USER=#{ew.entity.temporaryUser}</if>
<if test= "ew.entity.status!=null" > AND STATUS=#{ew.entity.status}</if>
<if test= "ew.entity.createdUser!=null" > AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test= "ew.entity.createdDateTime!=null" > AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_USER_RESOURCE WHERE HANDLE IN (
<foreach item= "item" index= "index" collection= "coll" separator= "," > #{item}
</foreach> )
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
<select id= "findEnableList" resultMap= "BaseResultMap" >
SELECT <include refid= "Base_Column_List" > </include>
FROM Z_USER_RESOURCE
WHERE SITE = #{site}
<if test= "resource != null and resource != ''" >
AND RESRCE = #{resource}
</if>
<if test= "user != null and user != ''" >
AND USER_ID = #{user}
</if>
</select>
<select id= "findEmployeeList" resultType= "com.foreverwin.mesnac.meapi.model.NwaUser" >
SELECT A.SITE, A.USER_ID USER_NAME, B.FIRST_NAME, B.LAST_NAME, NVL(B.FULL_NAME, A.USER_DESCRIPTION) FULL_NAME
FROM Z_USER_RESOURCE A
LEFT JOIN Z_NWA_USER B ON A.SITE = B.SITE AND A.USER_ID = B.USER_NAME
WHERE A.SITE = #{site} AND A.RESRCE = #{resource}
</select>
<select id= "findAll" resultMap= "UserResourceDto" >
SELECT ROW_NUMBER() OVER(ORDER BY ZUR.RESRCE ASC) SEQ,ZUR.*,R.DESCRIPTION RESOURCE_DESCRIPTION
FROM Z_USER_RESOURCE ZUR
INNER JOIN RESRCE R ON ZUR.RESOURCE_BO = R.HANDLE
WHERE ZUR.SITE = #{site}
<if test= "resource != null and resource != ''" >
AND (ZUR.RESRCE LIKE '%${resource}%'
OR R.DESCRIPTION LIKE '%${resource}%')
</if>
<if test= "userId != null and userId != ''" >
AND (ZUR.USER_ID LIKE '%${userId}%'
OR ZUR.USER_DESCRIPTION LIKE '%${userId}%')
</if>
</select>
</mapper>