æ¹æ³ä¸ï¼
<insert id="insertbatch" parameterType="java.util.List">
<selectKey keyProperty="fetchTime" order="BEFORE"
resultType="java.lang.String">
SELECT CURRENT_TIMESTAMP()
</selectKey>
insert into kangaiduoyaodian ( depart1, depart2, product_name,
generic_name, img, product_specification, unit,
approval_certificate, manufacturer, marketPrice, vipPrice,
website, fetch_time, productdesc ) values
<foreach collection="list" item="item" index="index"
separator=",">
( #{item.depart1}, #{item.depart2}, #{item.productName},
#{item.genericName}, #{item.img},
#{item.productSpecification}, #{item.unit},
#{item.approvalCertificate}, #{item.manufacturer},
#{item.marketprice}, #{item.vipprice}, #{item.website},
#{fetchTime}, #{item.productdesc} )
</foreach>
</insert>
æ¹æ³äºï¼
<insert id="batchInsertB2B" parameterType="ArrayList">
insert into xxxxtable(hkgs,hkgsjsda,office,asdf,ddd,ffff,supfullName,classtype,agent_type,remark)
<foreach collection="list" item="item" index="index" separator="union all">
select #{item.hkgs,jdbcType=VARCHAR},
#{item.hkgsjsda,jdbcType=VARCHAR},
#{item.office,jdbcType=VARCHAR},
#{item.asdf,jdbcType=VARCHAR},
#{item.ddd,jdbcType=VARCHAR},
#{item.ffff,jdbcType=VARCHAR},
#{item.supfullName,jdbcType=VARCHAR},0,0,
#{item.remark,jdbcType=VARCHAR} from dual
</foreach>
</insert>
å¯ä»¥èèç¨union allæ¥å®ç°æ¹éæå
¥ã
ä¾å¦ï¼
insert into XX_TABLE(XX,XX,XX)select 'xx','xx','xx' union all select 'xx','xx','xx' union all select 'xx','xx','xx' ...
å
æ¼è£
好è¯å¥åå¨æä¼ å
¥insert into XX_TABLE(XX,XX,XX)åé¢é¨å
温馨提示:答案为网友推荐,仅供参考