<insert id="add" parameterType="java.util.List" >
merge into table T1
using (
<foreach collection="list" item="item" index="index" separator="union" >
SELECT
XX,
XX
FROM DUAL
</foreach>
) T2
on (关系式如:T1.字段=T2.字段)
when matched then UPDATE SET xx=xx
when not matched then INSERT (xx,xx) VALUES (xx,xx)
</insert>