45 lines
1.7 KiB
XML
45 lines
1.7 KiB
XML
|
|
<?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.redstar.auth.mapper.UserMapper">
|
||
|
|
|
||
|
|
<select id="selectRoleByUid" resultType="java.lang.String">
|
||
|
|
SELECT DISTINCT
|
||
|
|
( r.role )
|
||
|
|
FROM
|
||
|
|
user_role r
|
||
|
|
LEFT JOIN user_role_mapping rm ON r.id = rm.user_role_id
|
||
|
|
${ew.customSqlSegment}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectRoleByGroup" resultType="java.lang.String">
|
||
|
|
SELECT DISTINCT
|
||
|
|
( user_role.role )
|
||
|
|
FROM
|
||
|
|
user_role
|
||
|
|
where user_role.id IN ( SELECT role_id FROM user_group_mapping LEFT JOIN user_group_role_mapping
|
||
|
|
ON user_group_mapping.group_id = user_group_role_mapping.group_id
|
||
|
|
where user_group_mapping.uid =#{uid} and user_group_mapping.enterprise_id =#{enterpriseId} and user_group_mapping.sys_type= #{sysType} )
|
||
|
|
and user_role.sys_type= #{sysType}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectAuthorityByUid" resultType="java.lang.String">
|
||
|
|
SELECT DISTINCT
|
||
|
|
( a.authority )
|
||
|
|
FROM
|
||
|
|
user_menu a
|
||
|
|
LEFT JOIN user_role_authority_mapping ram ON ram.user_authority_id = a.id
|
||
|
|
LEFT JOIN user_role r ON r.id = ram.user_role_id
|
||
|
|
LEFT JOIN user_role_mapping rm ON rm.user_role_id = r.id
|
||
|
|
WHERE
|
||
|
|
rm.uid = #{uid, jdbcType=INTEGER}
|
||
|
|
<if test="enterpriseId != null ">
|
||
|
|
and rm.enterprise_id = #{enterpriseId, jdbcType=INTEGER}
|
||
|
|
</if>
|
||
|
|
<if test="sysType != null and sysType != '' ">
|
||
|
|
and a.sys_type = #{sysType,jdbcType=INTEGER}
|
||
|
|
</if>
|
||
|
|
and a.type=2
|
||
|
|
</select>
|
||
|
|
|
||
|
|
</mapper>
|