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);
网友评论