<?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="com.lframework.xingyun.template.inner.mappers.system.SysUserRoleMapper">
    <sql id="SysUserRoleDto_sql">
        SELECT
            ur.*
        FROM sys_user_role AS ur
        INNER JOIN sys_role AS r ON r.id = ur.role_id
    </sql>
    <select id="getByUserId" resultType="com.lframework.xingyun.template.inner.entity.SysUserRole">
        <include refid="SysUserRoleDto_sql"/>
        WHERE ur.user_id = #{userId}
        ORDER BY r.code
    </select>
</mapper>
