package org.dromara.system.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.system.domain.SysUserRole;

import java.util.List;

/**
 * 用户与角色关联表 数据层
 *
 * @author Lion Li
 */
@Mapper
public interface SysUserRoleMapper extends BaseMapperPlus<SysUserRole, SysUserRole> {

    List<Long> selectUserIdsByRoleId(Long roleId);

    @Select("select role_id from sys_user_role where user_id = ${userId} order by role_id asc limit 1")
    Long selectMaxRoleIdByUserId(Long userId);

    @Select("select role_id from sys_user_role where user_id = ${userId}")
    List<Long> selectRoleIdsByUserId(Long userId);
}
