<?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.dxhy.admin.sys.dao.SysUserRoleDao">

    <select id="queryRoleIdList" resultType="long">
        select role_id
        from sys_user_role
        where user_id = #{userId}
    </select>


    <delete id="deleteBatch">
        delete from sys_user_role where role_id in
        <foreach item="roleIds" index="index" collection="roleIds" open="(" separator="," close=")">
            #{roleIds}
        </foreach>
    </delete>

    <select id="queryRole" resultType="com.dxhy.admin.sys.entity.SysRoleEntity">
        SELECT role.role_id,
               role.role_name
        FROM sys_role role
                 LEFT JOIN sys_user_role ru ON role.role_id = ru.role_id
        where ru.user_id = #{userId}
    </select>
</mapper>
