function obj2Sql (tablename, obj) {
var sqls = "",f = "", v = "";
obj.forEach(o => {
f = "";v = "";
for (let k in o) {
f += "" + k + ",";
v += typeof o[k] === "number" ? o[k] + "," : "'" + o[k] + "',";
}
sqls += "insert into " + tablename + " (" + f.substring(0, f.length - 1) + ") values (" + v.substring(0, v.length - 1) + ");\n";
});
console.log(sqls);
}
09-20
960
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-28