<?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.PrivilageRoleDOMapper">

    <select id="selectRoleByUserId" resultType="com.kiisoo.ic.system.entity.PrivilageRoleDO">
      select t3.id as id ,  t3.code as `code`, t3.name as `name`, t3.operation as `operation`, t3.create_time as createTime, t3.update_time as updateTime
        from privilage_user t1, privilage_user_role t2, privilage_role t3
        where t1.id = t2.user_id
        and t2.role_id = t3.id
        and t1.id = #{userId}
        limit 1
    </select>

    <select id="selectRoleName" resultType="com.kiisoo.ic.system.entity.PrivilageRoleDO" parameterType="java.lang.Long">
        select distinct t2.id,t2.name,t2.code
        from privilage_user_role t1, privilage_role t2
        where  t1.role_id =t2.id
        and t1.user_id=#{userId,jdbcType=BIGINT}
        limit 1
    </select>
</mapper>
