mybatis使用mysql数据库批量插入xml配置
程序员文章站
2022-03-03 13:03:12
...
<insert id="insertBatch" parameterType="list"> insert into trait (trait_id, trait_en, trait_cn, gene_num, marker_num, remark, source,gmt_create, gmt_update ) values <foreach collection="list" item="item" separator=","> ( #{item.traitId,jdbcType=VARCHAR}, #{item.traitEn,jdbcType=VARCHAR}, #{item.traitCn,jdbcType=VARCHAR}, #{item.geneNum,jdbcType=INTEGER}, #{item.markerNum,jdbcType=INTEGER}, #{item.remark,jdbcType=VARCHAR},#{item.source,jdbcType=VARCHAR}, now(), now() ) </foreach> </insert>