<?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.huimv.env.admin.mapper.MenuMapper">


    <select id="getMyMenu" resultType="com.huimv.env.admin.entity.Menu">
        SELECT * FROM sys_menu
        WHERE id IN
        (SELECT DISTINCT(menu_id) FROM sys_group_menu WHERE group_id IN
        (SELECT group_id FROM sys_account_group WHERE account_id=#{accountName} ))
        ORDER BY sort ASC
    </select>


    <select id="getMyButton" resultType="string">
        SELECT permission FROM sys_menu
        WHERE id IN
        (SELECT DISTINCT(menu_id) FROM sys_group_menu WHERE group_id IN
        (SELECT group_id FROM sys_account_group WHERE
        account_id=#{userId}))
        and weight =2
        ORDER BY sort ASC
    </select>
</mapper>
