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

* 用户角色表 Mapper 接口 *

* * @Author scott * @since 2018-12-21 */ public interface SysUserRoleMapper extends BaseMapper { @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); @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); @Select("SELECT c.depart_id, c.role_name FROM sys_user a " + "join sys_depart_role_user b on a.id = b.user_id " + "join sys_depart_role c on b.drole_id = c.id " + "WHERE a.username =#{username} ORDER BY c.depart_id ") List> getDepartRoleByName(@Param("username") String username); @Select("select role_name 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 getRoleNameByUserName(@Param("username") String username); }