<?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.example.demo.mapper.PermissionMapper">

    <resultMap id="permissionResultMap" type="com.example.demo.entity.Permission">
        <id column="id" property="id"/>
        <result column="name" property="name"/>
        <result column="url" property="url"/>
    </resultMap>

    <select id="listPermissionCascadeByRole" resultType="com.example.demo.entity.Permission">
        select
            permission.id id,permission.`name` name,permission.url url
        from
            role_permission
        left join
            permission
        on
            role_permission.permission_id=permission.id
        where
            role_permission.role_id=#{roleId}
    </select>
</mapper>
