1. <!-- 查询用户角色集合 连接查询 -->
    2. <select id="selectSysRoleByUserId" parameterType="long" resultType="com.sh.demo.core.entity.SysRoleEntity" >
    3. SELECT sr.* FROM sys_role sr
    4. LEFT JOIN sys_user_role se ON sr.role_id=se.role_id
    5. WHERE se.user_id = #{userId}
    6. </select>
    1. <!-- 查询用户角色集合 子查询 -->
    2. < SELECT id = "selectSysMenuByRoleId" parameterType = "Long" resultMap = "SysMenuResult" >
    3. < include refid = "selectSysMenuVo" />
    4. WHERE
    5. menu_id IN (
    6. SELECT
    7. menu_id
    8. FROM
    9. sys_role_menu
    10. WHERE
    11. role_id = #{roleId} )
    12. </ SELECT>