<?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.njzscloud.supervisory.menu.mapper.SysMenuMapper">
    <select id="selectMenuByUserId" resultType="com.njzscloud.supervisory.menu.pojo.SysMenuEntity">
        SELECT a.id,
        a.sn,
        a.pid,
        a.title,
        a.icon,
        a.tier,
        a.breadcrumb,
        a.sort,
        a.route_name,
        a.menu_category
        FROM sys_menu a
        INNER JOIN sys_role_resource b ON b.data_id = a.id AND b.table_name = 'sys_menu'
        AND b.role_id IN (SELECT a.id
        FROM sys_role a
        INNER JOIN sys_user_role b ON b.role_id = a.id AND b.user_id = #{userId}
        WHERE a.deleted = 0)
        WHERE a.deleted = 0
    </select>

</mapper>
