<insert id="addCgd" parameterType="List" useGeneratedKeys="false">
INSERT INTO is_sys_code_table(id, type, code, name, alias, sort, enable) VALUES
<foreach collection='c.codeTables' index='index' item='t' separator=','>
(
#{t.id},
#{c.type},
#{t.value},
#{t.name},
#{t.alias},
#t.sort},
#{t.enable}
)
</foreach>
</insert>
方式2
参数为 List<Map>
<insert id="addCgd" parameterType="List" useGeneratedKeys="false">
insert into T_SP_2CGD(
uname,address,age)
<foreach collection="list" index="key" item="value" separator="UNION ALL">
(select
#{value.uname},#{value.address},#{value.age}
from DUAL
)
</foreach>
</insert>