<?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.css.simulation.resource.server.infra.db.mysql.mapper.MenuMapper" >


    <select id="getMyMenuTree" parameterType="java.lang.String" resultType="api.common.pojo.vo.system.MenuVO">
        select
            m.id,
            m.name,
            m.router,
            m.icon,
            m.sort,
            m.parent_id,
            m.visible
				FROM system_role r
        INNER JOIN system_role_menu rm ON rm.role_id = r.id AND rm.is_deleted='0'
        INNER JOIN system_menu m ON m.id=rm.menu_id AND m.visible='1' AND m.is_deleted='0'
        WHERE r.role_code = #{roleCode,jdbcType=VARCHAR}
		  AND r.visible='1' AND r.is_deleted='0'
        ORDER BY m.sort
    </select>

    <select id="getMenuTree" parameterType="java.lang.String" resultType="api.common.pojo.vo.system.MenuVO">
        select
            m.id,
            m.name,
            m.router,
            m.icon,
            m.sort,
            m.parent_id,
            m.visible
        FROM system_menu m
        where m.visible='1' AND m.is_deleted='0'
        ORDER BY m.sort
    </select>
</mapper>
