mybatis自动生成sql变量及批量insert限制

原因 是mybatis的这个useGeneratedKeys属性的问题,

写成了这样就不报错了
useGeneratedKeys="false">


详细配置如下:


useGeneratedKeys="false">
insert into t_wx_article(id, title, categoryid, wxid,
author, content,
hits, likes, imageurl,
addtime,
istop,
isrecommand, ishot, iscolor, status) 
selectseq_wx_article.nextval, A.* from (
separator=" UNION ALL ">
select 
#{item.title,jdbcType=VARCHAR} title,
'000000' categoryid,
#{item.wxId,jdbcType=NUMERIC} wxId,
#{item.author,jdbcType=VARCHAR} author,
#{item.content,jdbcType=VARCHAR} content, 0 hits,
0 likes,
#{item.imageUrl,jdbcType=VARCHAR} imageurl,
sysdate addtime,
0 istop, 0 isrecommand, 0 ishot,
0 iscolor,
0 status 
from dual

) A


自定义id,内存生成的id


 
   
       
   

insert into t_wx_article(id, groupid, title, categoryid, wxid,
author, content,
hits, likes, imageurl,
addtime,
istop,
isrecommand, ishot, iscolor, status) 
select seq_wx_article.nextval, A.* from (

select 
#{groupid},
#{item.title,jdbcType=VARCHAR} title,
'000000' categoryid,
#{item.wxId,jdbcType=NUMERIC} wxId,
#{item.author,jdbcType=VARCHAR} author,
#{item.content,jdbcType=VARCHAR} content, 0 hits,
0 likes,
#{item.imageUrl,jdbcType=VARCHAR} imageurl,
sysdate addtime,
0 istop, 0 isrecommand, 0 ishot,
0 iscolor,
0 status 
from dual

) A



你可能感兴趣的:(mybatis自动生成sql变量及批量insert限制)