Oracle
Mapper.xml
。
<insert id="insertBatchAgentShareDetail" parameterType="java.util.ArrayList">
<![CDATA[
insert all
]]>
<foreach collection="list" item="detail" index="index">
<![CDATA[
INTO UCF_AGENT_SHARE_DETAIL (ID,TOTAL_AMOUNT,TOTAL_FEE_AMOUNT,TOTAL_AGENT_FEE_AMOUNT,TOTAL_SHARE_AMOUNT,
SHARE_RECORD_ID,PRODUCT_CODE,CARD_TYPE,TRADE_COUNT,SETTLE_DETAIL_ID)
VALUES(#{detail.id,jdbcType=VARCHAR},#{detail.totalAmount,jdbcType=NUMERIC},#{detail.totalFeeAmount,jdbcType=NUMERIC},#{detail.totalAgentFeeAmount,jdbcType=NUMERIC},
#{detail.totalShareAmount,jdbcType=NUMERIC},#{detail.shareRecordId,jdbcType=VARCHAR},#{detail.productCode,jdbcType=VARCHAR},
#{detail.cardType,jdbcType=VARCHAR},#{detail.tradeCount,jdbcType=NUMERIC},#{detail.settleDetailId,jdbcType=VARCHAR})
]]>
</foreach>
<![CDATA[
select * from dual
]]>
</insert>
sql语句
insert all
into TABLE (ID, TEXT, STAUTS) values (xx, xx, xx)
into TABLE (ID, TEXT, STAUTS) values (xx, xx, xx)
into TABLE (ID, TEXT, STAUTS) values (xx, xx, xx)
select * from dual
mysql
mapper.xml
<insert id="batchInsertUcfUserBatchImport" parameterType="java.util.List">
<![CDATA[
INSERT INTO UCF_USER_BATCH_IMPORT (ID,TEXT,STSTUS) VALUES
]]>
<foreach collection="list" item="item" index="index" separator="," >
<![CDATA[
(
#{item.id,jdbcType=NUMERIC},
#{item.text,jdbcType=VARCHAR},
#{item.status,jdbcType=VARCHAR}
)
]]>
</foreach>
</insert>
sql
insert into TABLE (ID, TEXT, STAUTS) values
(xx, xx, xx),
(xx, xx, xx),
(xx, xx, xx)
批量修改
mapper.xml
<update id="updateBatchMerchantSettleRecord" parameterType="java.util.ArrayList">
<foreach collection="list" item="record" index="index" open="begin" close=";end;" separator=";">
<![CDATA[ UPDATE UCF_MERCHANT_SETTLE_RECORD ]]>
<trim prefix="SET" suffixOverrides=",">
<if test="null != record.shareStatus and '' != record.shareStatus ">
<![CDATA[ SHARE_STATUS = #{record.shareStatus} ,]]>
</if>
</trim>
<trim prefix="WHERE" prefixOverrides="AND">
<if test="null != record.id and '' != record.id">
<![CDATA[ AND ID = #{record.id} ]]>
</if>
</trim>
</foreach>
</update>
版权声明:本文为weixin_42668497原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。