<?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.ningdatech.carapi.sys.mapper.RoleAuthorityMapper">

    <select id="selectDataScopeIdFromRoleByUserId" parameterType="map" resultType="java.lang.Long">
        SELECT DISTINCT rrds.authority_id
        FROM c_role_authority rrds
                 INNER JOIN c_role r on r.id = rrds.role_id
                 INNER JOIN c_user_role er on er.role_id = r.id
        WHERE r.category = #{category}
          and er.user_id = #{userId}
          and r.state = true
    </select>

</mapper>
