<?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.zhentao.mapper.UserRoleMapper">
    
    <!-- 根据用户ID查询角色ID列表 -->
    <select id="selectRoleIdsByUserId" resultType="java.lang.Integer">
        SELECT role_id
        FROM admin_user_role
        WHERE user_id = #{userId}
    </select>
    
    <!-- 根据用户ID删除所有角色关联 -->
    <delete id="deleteByUserId">
        DELETE FROM admin_user_role
        WHERE user_id = #{userId}
    </delete>
    
</mapper>

