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

2019-12-02  本文已影响0人  吃货_ee62

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);

上一篇下一篇

猜你喜欢

热点阅读