package org.jeecg.modules.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.entity.SysUserRole; import java.util.List; /** *

* 用户角色表 Mapper 接口 *

* * @Author scott * @since 2018-12-21 */ public interface SysUserRoleMapper extends BaseMapper { /** * 通过用户账号查询角色集合 * @param username 用户账号名称 * @return List */ @Select("select role_code from sys_role where id in (select role_id from sys_user_role where user_id = (select id from sys_user where username=#{username}))") List getRoleByUserName(@Param("username") String username); /** * 通过用户账号查询角色Id集合 * @param username 用户账号名称 * @return List */ @Select("select id from sys_role where id in (select role_id from sys_user_role where user_id = (select id from sys_user where username=#{username}))") List getRoleIdByUserName(@Param("username") String username); /** * 根据角色查询用户 * @param roleList role_code集合 * */ List getUsersByRoles(@Param("roleList") List roleList); /** * 通过角色id获取用户username * @param roleId */ @Select("select username from sys_user where id in (select user_id from sys_user_role where role_id = #{roleId})") List getUserNameByRoleId(@Param("roleId") String roleId); }