「Java開発」mybatisで一括データを挿入するサンプルコード

Javaコード:
<insert id="batchInsert" parameterType="java.util.List">
insert into T_DT_DICT (ID, PROJECT_ID, NAME,
PARENT_ID, LEVEL, PATH,
CREATE_DATE, MODIFIER_ID, MODIFIER,
MODIFY_DATE, SEQUENCE, CODE
)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id},#{item.projectId},#{item.name},#{item.parentId},#{item.level},#{item.path},#{item.createDate},
#{item.modifierId},#{item.modifier},#{item.modifyDate},#{item.sequence},#{item.code}
)
</foreach>
</insert>

Java

Posted by arkgame