<?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.energy.manage.service.mappers.system.SysUserRoleMapper">

    <update id="updateUserRole">
        update sys_user_role set role_id = #{roleId} where user_id = #{userId}
    </update>

    <select id="selectRoleIdByUserId" parameterType="java.lang.Long" resultType="java.lang.Integer">
        select
        r.role_id
        from sys_role r
        inner join sys_user_role u on u.role_id = r.id
        where u.user_id = #{adminId}
    </select>
</mapper>
