mapper.xml内容
<!-- 批量插入 --> <insert id="insertSalconfigAfter" parameterType="java.util.List"> <![CDATA[ INSERT INTO TB_DEPARTMENT (id,s1,s2,s3,s4,s5,s6) ]]> select TB_MY_SEQUENCE.NEXTVAL,m.* from ( <foreach collection="list" item="item" index="index" separator="union all"> select #{item.s1,jdbcType=VARCHAR}, #{item.s2,jdbcType=VARCHAR}, #{item.s3,jdbcType=VARCHAR}, #{item.s4,jdbcType=VARCHAR}, #{item.s5,jdbcType=VARCHAR}, #{item.s6,jdbcType=VARCHAR} from dual </foreach> ) m </insert> java调用代码: List<TbDepartment> list= new ArrayList<TbDepartment>(); sqlSessionTemplate.insert("insertSalconfigAfter", list);