insert ALL
into CU_MEMBER_TRADE_DETAIL(period,pk_member_trade,consume_money,pk_country,creation_time,pk_creator) values
(
#{item.period},#{item.pkMemberTrade},#{item.consumeMoney,jdbcType=NUMERIC},#{item.pkCountry},
#{item.creationTime, jdbcType=TIMESTAMP},#{item.pkCreator}
)
SELECT 1 FROM dual
merge into cu_member_trade_detail a
using (
select cd.pk_id, cd.consume_money
from cu_member_trade ct
inner join cu_member_trade_detail cd
on cd.pk_member_trade = ct.pk_id
where cd.del_flag = 0
and ct.del_flag = 0
and cd.trade_statue = 1
and cd.period between #{startPeriod} and #{endPeriod}
and ct.pk_country = #{pkCountry}
) b
on (a.pk_id = b.pk_id)
when matched then
update set a.consume_money = 0,modified_time = sysdate