ORACLE数据库:
<insert id="batchInsertRoleRMenu" parameterType="java.util.List" >
INSERT INTO QCMS_PUB_ROLE_R_MENU(
MENU_ID,
ROLE_ID
) (
<foreach collection="list" item="item" index="index" separator="UNION ALL">
select
#{item.menuId,jdbcType=NUMERIC},
#{item.roleId,jdbcType=NUMERIC}
from dual
</foreach>
)
</insert>
mybaits等其他数据库:
<insert id="batchInsertRoleRMenu" parameterType="java.util.List" >
INSERT INTO QCMS_PUB_ROLE_R_MENU(
MENU_ID,
ROLE_ID
)VALUES
<foreach collection="list" item="item" index="index" separator="," >
(
#{item.menuId,jdbcType=NUMERIC},
#{item.roleId,jdbcType=NUMERIC}
)
</foreach>
</insert>