<?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.xunmei.system.mapper.RoleMapper">

    <sql id="selectRoleVo">
        SELECT DISTINCT
            r.id,
            r.role_name,
            r.role_key,
            r.role_sort,
            r.data_scope,
            r.menu_check_strictly,
            r.dept_check_strictly,
            r.STATUS,
            r.del_flag,
            r.create_time,
            r.remark
        FROM
            t_role r
                LEFT JOIN t_user_role ur ON ur.role_id = r.id
    </sql>

    <select id="selectRolePermissionByUserId" resultType="com.xunmei.system.api.domain.Role"
            parameterType="java.lang.Long">
        <include refid="selectRoleVo"/>
        where r.del_flag = 0 and ur.user_id = #{userId}
    </select>



</mapper>