mybatis注解批量插入数据库
解决方法:
先将要插入的数据放到集合result
@Insert("<script> insert into wxinfo (openid,nickname) values " +
" <foreach collection='result' item='item' separator=',' > " +
" (#{item.openid},#{item.nickname})\n" +
" </foreach> </script>")
Boolean insertBatchCode(@Param(value = "result") List<WeixinUserInfo> result);
" <foreach collection='result' item='item' separator=',' > " +
" (#{item.openid},#{item.nickname})\n" +
" </foreach> </script>")
Boolean insertBatchCode(@Param(value = "result") List<WeixinUserInfo> result);