|
|
|
<?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.epmet.dao.UserRoleDao">
|
|
|
|
|
|
|
|
<resultMap type="com.epmet.entity.UserRoleEntity" id="userRoleMap">
|
|
|
|
<result property="id" column="ID"/>
|
|
|
|
<result property="customerId" column="CUSTOMER_ID"/>
|
|
|
|
<result property="gridId" column="GRID_ID"/>
|
|
|
|
<result property="userId" column="USER_ID"/>
|
|
|
|
<result property="roleId" column="ROLE_ID"/>
|
|
|
|
<result property="delFlag" column="DEL_FLAG"/>
|
|
|
|
<result property="revision" column="REVISION"/>
|
|
|
|
<result property="createdBy" column="CREATED_BY"/>
|
|
|
|
<result property="createdTime" column="CREATED_TIME"/>
|
|
|
|
<result property="updatedBy" column="UPDATED_BY"/>
|
|
|
|
<result property="updatedTime" column="UPDATED_TIME"/>
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<!-- 如果没有传gridId只查用户的非网格级别的身份 -->
|
|
|
|
<select id="getUserRoleInfo" parameterType="com.epmet.dto.form.UserRoleFormDTO"
|
|
|
|
resultType="com.epmet.dto.result.UserRoleResultDTO">
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
DISTINCT
|
|
|
|
er.ROLE_NAME,
|
|
|
|
er.ROLE_KEY
|
|
|
|
FROM
|
|
|
|
USER_ROLE ur
|
|
|
|
JOIN EPMET_ROLE er ON ur.ROLE_ID = er.ID
|
|
|
|
<where>
|
|
|
|
er.DEL_FLAG = 0
|
|
|
|
AND
|
|
|
|
ur.DEL_FLAG = 0
|
|
|
|
AND
|
|
|
|
ur.USER_ID = #{userId}
|
|
|
|
<if test='null != gridId and "" != gridId'>
|
|
|
|
AND( ur.GRID_ID = #{gridId} OR ur.GRID_ID = 'all' )
|
|
|
|
</if>
|
|
|
|
<if test='null == gridId or "" == gridId'>
|
|
|
|
AND ur.GRID_ID = 'all'
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 如果没有传gridId只查用户的非网格级别的身份 -->
|
|
|
|
<select id="getUserRoleList" parameterType="com.epmet.dto.form.UserRoleFormDTO"
|
|
|
|
resultType="string">
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
DISTINCT
|
|
|
|
|
|
|
|
er.ROLE_NAME
|
|
|
|
FROM
|
|
|
|
USER_ROLE ur
|
|
|
|
JOIN EPMET_ROLE er ON ur.ROLE_ID = er.ID
|
|
|
|
<where>
|
|
|
|
er.DEL_FLAG = 0
|
|
|
|
AND
|
|
|
|
ur.DEL_FLAG = 0
|
|
|
|
AND
|
|
|
|
ur.USER_ID = #{userId}
|
|
|
|
<if test='null != gridId and "" != gridId'>
|
|
|
|
AND( ur.GRID_ID = #{gridId} OR ur.GRID_ID = 'all' )
|
|
|
|
</if>
|
|
|
|
<if test='gridId == null or gridId = ""'>
|
|
|
|
AND ur.GRID_ID = 'all'
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
</mapper>
|