映射文件 以传入一个List为例
<insert id="[方法名]" useGeneratedKeys="true" parameterType="java.util.List"> <selectKey resultType="[数据类型]" keyProperty="id" order="AFTER"> SELECT LAST_INSERT_ID() </selectKey> insert into table_name([字段名],[字段名]) values <foreach collection="list" item="item" index="index" separator="," > (#{item.[属性名]},#{item.[属性名]}) </foreach> </insert>
selectKey设置insert时主键不自动生成时如何配置