<?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.tycoding.langchat.upms.mapper.SysUserRoleMapper">

    <select id="getUserListByRoleId" resultType="cn.tycoding.langchat.upms.entity.SysUser">
        SELECT `user`.*
        FROM sys_user `user`,
             sys_user_role sur,
             sys_role `role`
        WHERE `user`.id = sur.user_id
          AND sur.role_id = `role`.id
          AND `role`.id = #{roleId}
    </select>

    <select id="getRoleListByUserId" resultType="cn.tycoding.langchat.upms.entity.SysRole">
        SELECT `role`.*
        FROM sys_user `user`,
             sys_user_role sur,
             sys_role `role`
        WHERE `user`.id = sur.user_id
          AND sur.role_id = `role`.id
          AND `user`.id = #{userId}
    </select>
</mapper>
