<?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.github.niefy.modules.sys.dao.SysMenuDao">
    <cache-ref namespace="com.github.niefy.modules.sys.dao.SysMenuDao"/>

    <select id="queryListParentId" resultType="com.github.niefy.modules.sys.entity.SysMenuEntity">
        select * from sys_menu where parent_id = #{parentId} order by order_num asc
    </select>

    <select id="queryNotButtonList" resultType="com.github.niefy.modules.sys.entity.SysMenuEntity">
        select * from sys_menu where type != 2 order by order_num asc
    </select>
    <select id="queryUserAllMenu" resultType="com.github.niefy.modules.sys.entity.SysMenuEntity">
        select m.* from sys_user_role ur
        LEFT JOIN sys_role_menu rm on ur.role_id = rm.role_id
        LEFT JOIN sys_menu m on rm.menu_id = m.menu_id
        where ur.user_id = #{userId}
    </select>

</mapper>
