<?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.jkcredit.invoice.hub.mapper.UserRolePermissionMapper">
    <resultMap id="baseResultMap" type="com.jkcredit.invoice.hub.model.po.userRolePermission.UserRolePermissionPo">
        <id column="id" property="id"/>
        <result column="user_id" property="userId"/>
        <result column="role_id" property="roleId"/>
        <result column="permission_id" property="permissionId"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="activated" property="activated"/>
    </resultMap>

    <select id="getUserRolePermissionByRoleId" resultMap="baseResultMap">
        select * from h_user_role_permission where role_id = #{roleId} and activated = 1
    </select>
    <select id="getUserIdByRoleId" resultType="java.lang.Long">
        select distinct user_id from h_user_role_permission where role_id = #{roleId} and activated = 1
    </select>
</mapper>
