<?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="cn.com.ctop.common.module.mapper.SysRoleExtMapper">

	<!-- 根据roleCode获取roleId -->
	<select id="getRoleIdByRoleCode" resultType="java.lang.String">
		select
		id
		from sys_role
		where role_code = #{roleCode}
	</select>

	<!-- 根据userId获取角色code -->
	<select id="getRoleCodeByUserId" resultType="java.lang.String">
		select
		c.role_code
		from
		sys_user a
		left join sys_user_role b on a.id = b.user_id
		left join sys_role c on b.role_id = c.id
        where
        a.id = #{userId}
	</select>

</mapper>
