介绍
1
void createFollowReport(@Param("follow") List<Map<String,Object>> follow);
<insert id="createFollowReport">
replace into la_task_top_follow (mid,date,uid,count) values
<foreach collection="follow" item="t" open="" close="" separator=",">
(#{t.mid}, #{t.date}, #{t.uid}, #{t.count})
</foreach>
</insert>
2
void saveFollowReport(@Param("taskId") Long taskId, @Param("follow") Map<String,Object> follow);
key是map的key,value是map的value
<insert id="saveFollowReport">
replace into cis_task_top_follow (
task_id, uid, count
) VALUES
<foreach collection="follow.entrySet()" close=")" separator="),(" open="(" index="key" item="value">
#{taskId}, #{key}, #{value}
</foreach>
</insert>
参考博客
[1]