<?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.kiisoo.ic.system.mapper.PrivilageRolePermissionDOMapper">

    <select id="selectLoginPermission" resultType="com.kiisoo.ic.system.bean.LoginPermissionBean">
      select t4.id as id, t4.name as `name`, t4.parent_id as pid, t4.`level` as `level`, t4.resource as resource
        from privilage_user t1, privilage_user_role t2, privilage_role_permission t3, privilage_permission t4
        where t1.id = t2.user_id
        and t2.role_id = t3.role_id
        and t3.permission_id = t4.id
        and t1.id = #{userId}
        and t4.`level` = #{level}
        ORDER BY t4.id
    </select>

</mapper>
