<?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.njcn.product.cnuser.user.mapper.SysFunctionMapper">


    <select id="getMenuByUserId" resultType="com.njcn.product.cnuser.user.pojo.vo.MenuVO">
        SELECT distinct a.id        as id,
                        a.path      as path,
                        a.name      as name,
                        a.code      as code,
                        a.component as component,
                        a.icon      as icon,
                        a.pId       as pId,
                        a.sort      as sort
        FROM sys_function a
                 inner join sys_role_function b on a.id = b.Function_Id
                 inner join sys_user_role c on b.Role_Id = c.Role_Id
        WHERE c.user_Id = #{userId}
          AND a.type in (0)
    </select>

    <select id="getButtonByUserId" resultType="com.njcn.product.cnuser.user.pojo.po.SysFunction">
        select distinct a.*
        from sys_function a
                 inner join sys_role_function b on a.id = b.Function_Id
                 inner join sys_user_role c on b.Role_Id = c.Role_Id
        where c.user_Id = #{userId}
          and a.type in (1)
    </select>
</mapper>

