MyBatis批量新增、删除

批量插入

Mapper

int insertUserInfo(@Param("users") ArrayList<UserEntity> -----);

Mapper.xml

<insert id="insertUserInfo"  parameterType="java.util.ArrayList">
	------ ---- ---- ---------- ---- ------
    <foreach collection ="users" item="item" separator =",">
        ------------------ ------------
    </foreach >
</insert>

批量删除

Mapper

int removeUserInfo(@Param("ids") String ---);

Mapper.xml

<update id="removeUserInfo">
    ------ ---- --- ---------- - - ----- -- --
    <foreach collection="ids.split(',')" index="index" item="item" open="(" separator="," close=")" >
        -- ---- -
    </foreach>
</update>