对应sql
insert into tabelname(colum1,colum2...) values(aa,aa...),(bb,bb...)
SELECT
LAST_INSERT_ID()
insert into wd_solr(fayu_id,tablename,name,logo,description,section_no,look_count,favorite_count,create_uid,create_time,update_time,timestamp)
values
(
#{wdSolr.fayuId},#{wdSolr.tablename},#{wdSolr.name},#{wdSolr.logo},
#{wdSolr.description},#{wdSolr.sectionNo},#{wdSolr.lookCount},#{wdSolr.favoriteCount},
#{wdSolr.createUid},#{wdSolr.createTime},#{wdSolr.updateTime},#{wdSolr.timestamp}
)
对应Sql
update tablename set
colum1= case id when 1 then aa
when 2 then bb
when 3 then cc
....
end,
colum2=case id when 1 then aa
when 2 then bb
when 3 then cc
....
end,
where id in (1,2,3....)
update wd_solr set
name =
when #{wdSolr.id} then
#{wdSolr.name}
,logo =
when #{wdSolr.id} then
#{wdSolr.logo}
,timestamp =
when #{wdSolr.id} then #{wdSolr.timestamp}
where id in
#{wdSolr.id}
对应sql
delete from tablename where id in (1,2,3....)
delete from wd_solr where
id in (
#{wdSolr.id}
)
注:批量插入、更新不建议使用,如果数据过大,参数过多同时操作于一条sql会极度占用连接资源,建议使用循环操作单条执行语句。