XML配置如下 ElementDefineMapper.xml
<insert id="batchInsert" parameterType="java.util.List" >
insert into AM_ELEMENT_DEFINE (ELEMENT_ID, ELEMENT_NAME, TYPE_ID, CATEGORY_ID)
<foreach collection="list" item="item" index="index" separator="union all">
select #{item.elementId,jdbcType=VARCHAR}, #{item.elementName,jdbcType=VARCHAR},
#{item.typeId,jdbcType=VARCHAR}, #{item.categoryId,jdbcType=VARCHAR}
from dual
</foreach>
</insert>
ElementDefineMapper dao层如下
void batchInsert(@Param('list') List inerstList);
如此这般即可