<?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.schoolinout.system.mapper.ParentStudentMapper">

    <insert id="insertBatch" parameterType="ParentStudent" useGeneratedKeys="true" keyProperty="id">
        INSERT INTO tb_school_student_parent_relation (student_id, parent_id)
        VALUES
        <foreach collection="list" item="item" separator=",">
            (#{item.studentId}, #{item.parentId})
        </foreach>
    </insert>
    <delete id="delateByParentId">
        DELETE
        FROM tb_school_student_parent_relation
        WHERE parent_id = #{parentId}
    </delete>
</mapper>