美文网首页
mybatis 添加多条数据(动态 :表名,列名,值)

mybatis 添加多条数据(动态 :表名,列名,值)

作者: 吃货_ee62 | 来源:发表于2019-12-02 17:50 被阅读0次

mybatis插入多条数据

@Insert(

"<script>" +

" INSERT INTO ${tableName}"+

         "<foreach item='item' index='index' collection='nameList' open='(' separator=',' close=')'>" +

               " ${item}"+

           "</foreach>"+

       " VALUES  "+

       "<foreach item='it' index='index' collection='valueList'  separator=',' close=';'>" +

            "<foreach item='its' index='index' collection='it' open='(' separator=',' close=')'>" +

                " #{its}"+

           "</foreach>"+

       "</foreach>"+

 "</script>")

//tableName  表名    nameList  列名     valueList 值

Integer insertDatas(@Param("tableName")String tableName,@Param("nameList")List nameList,@Param("valueList")List valueList);

相关文章

网友评论

      本文标题:mybatis 添加多条数据(动态 :表名,列名,值)

      本文链接:https://www.haomeiwen.com/subject/vkmfgctx.html