SysRoleMapper.java 944 字节
package com.skua.modules.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.skua.modules.system.entity.SysRole;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 角色表 Mapper 接口
 */
public interface SysRoleMapper extends BaseMapper<SysRole> {

    @Select("select * from sys_role where role_code = #{roleCode}")
    List<SysRole> getRoleIdByCode(@Param("roleCode") String roleCode);

    @Select("select r.* from sys_user_role u left join sys_role r on u.role_id = r.id where u.user_id=#{userId}")
    List<SysRole> queryUserRoles(@Param("userId") String userId);


    @Select("select r.* from sys_user u inner join sys_user_role ur on u.id = ur.user_id  left join sys_role r on ur.role_id = r.id where u.username=#{userName}")
    List<SysRole> queryUserRolesByUserName(@Param("userName") String userName);
}