1.对应的xml文件:
<!--批量添加-->
<insert id="insertStandardItemInfo" parameterType="hashmap">
insert into t_standard_item(standard_id,item_id)
values
<foreach collection="itemIdList" index="index" item="item" separator="," >
(#{standardId,jdbcType=INTEGER}, #{item,jdbcType=INTEGER})
</foreach>
</insert>
2.对应的mapper文件:
int insertStandardItemInfo(Map<String,Object> map);
3.对应的service文件:
Map<String, Object> map = new HashMap<>();
map.put("standardId", standardId);
map.put("itemIdList", itemIdList);
standardItemMapper.insertStandardItemInfo(map);