mysql,oracle批量导入数据
程序员文章站
2022-03-04 12:49:27
...
mybatis +mysql
<insert id="addRoleModule" parameterType="java.util.List">
INSERT INTO T_P_ROLE_MODULE (ROLE_ID, MODULE_ID)
VALUES <foreach collection="list" item="item" index="index"
separator=",">
( #{item.roleId}, #{item.moduleId})
</foreach>
</insert>
<insert id="addRoleModule" parameterType="java.util.List">
INSERT INTO T_P_ROLE_MODULE (ROLE_ID, MODULE_ID)
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
SELECT #{item.roleId}, #{item.moduleId} FROM DUAL
</foreach>
</insert>
转载于:https://my.oschina.net/u/1011897/blog/202913