<?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="me.zhengjie.modules.system.mapper.RoleDeptMapper">

    <insert id="insertData">
        insert into sys_roles_depts (role_id, dept_id)
        values
        <foreach collection="depts" item="item" open="(" separator="),(" close=")">
            #{roleId}, #{item.id}
        </foreach>
    </insert>

    <delete id="deleteByRoleId">
        delete from sys_roles_depts
        where role_id = #{roleId}
    </delete>

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