复制语句修改,日志打印优化

This commit is contained in:
暮光:城中城
2021-05-31 22:44:12 +08:00
parent 089fab958d
commit 50a1f794c2
4 changed files with 15 additions and 14 deletions

View File

@@ -16,11 +16,11 @@ export default {
let values = '';
dataCols.forEach(col => {
if (values.length > 0) values += ', ';
let val = item[col.prop];
let val = item[col.prop] || '';
if (typeof val === 'number' && !isNaN(val)) {
values += val;
} else {
val = val.replaceAll('\'', '\'\'');
val = String(val).replaceAll('\'', '\'\'');
values += "'" + val + "'";
}
});
@@ -36,7 +36,7 @@ export default {
dataCols.forEach(col => {
if (values.length > 0) values += ', ';
values += col.prop + '=';
let val = item[col.prop];
let val = item[col.prop] || '';
if (typeof val === 'number' && !isNaN(val)) {
values += val;
if (condition.indexOf(col.prop) >= 0) {
@@ -44,7 +44,7 @@ export default {
where += col.prop + ' = ' + val;
}
} else {
val = val.replaceAll('\'', '\'\'');
val = String(val).replaceAll('\'', '\'\'');
values += "'" + val + "'";
if (condition.indexOf(col.prop) >= 0) {
if (where.length > 0) where += ' and ';