Integer addAttachmentInfo(List<Attachment> list);
<insert id="addAttachmentInfo" parameterType="java.util.List" keyProperty="id" useGeneratedKeys="true">
INSERT INTO attachment (url,name,volume_id,upload_person_id,upload_time,file_size) values
<foreach collection="list" item="item" index="index" separator=",">
( #{item.url}, #{item.name}, #{item.volumeId}, #{item.uploadPersonId}, #{item.uploadTime}, #{item.fileSize})
</foreach>
</insert>
执行后插入后,可以看到list中的实体有自增id了