<?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="shop.alien.mapper.StorePlatformMenuMapper">

    <!-- 根据角色ID查询权限菜单列表 -->
    <select id="selectMenusByRoleId" resultType="shop.alien.entity.store.StorePlatformMenu">
        SELECT
            m.menu_id AS menuId,
            m.menu_name AS menuName,
            m.parent_id AS parentId,
            m.menu_type AS menuType,
            m.menu_sort AS menuSort,
            m.level AS level,
            m.path AS path,
            m.component AS component,
            m.perms AS perms,
            m.icon AS icon,
            m.status AS status,
            m.visible AS visible,
            m.is_frame AS isFrame,
            m.is_cache AS isCache,
            m.del_flag AS delFlag,
            m.create_by AS createBy,
            m.created_time AS createdTime,
            m.update_by AS updateBy,
            m.updated_time AS updatedTime,
            m.remark AS remark
        FROM
            store_platform_menu m
        INNER JOIN store_platform_role_menu rm ON m.menu_id = rm.menu_id
        WHERE
            rm.role_id = #{roleId}
            AND m.del_flag = '0'
            AND m.status = '0'
        ORDER BY
            m.menu_sort ASC
    </select>

</mapper>
