"use strict";
/**
 * sql工具模块
 * @date 2022-03
 * @author 何华东
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateReplaceSql = exports.generateInsertSql = void 0;
/**
  * 生成insert into sql语句
  */
function generateInsertSql(tableName, entity) {
    var keys = Reflect.ownKeys(entity).filter(function (s) { return entity[s] !== undefined && entity[s] !== null; });
    return "INSERT INTO " + tableName + "(" + keys.join(',') + ") VALUES (" + keys.map(function (s) {
        return typeof entity[s] === 'number' ? entity[s] : "'" + entity[s] + "'";
    }).join(',') + ")";
}
exports.generateInsertSql = generateInsertSql;
/**
 * 生成replace into sql语句
 */
function generateReplaceSql(tableName, entity) {
    var keys = Reflect.ownKeys(entity).filter(function (s) { return entity[s] !== undefined && entity[s] !== null; });
    return "REPLACE INTO " + tableName + "(" + keys.join(',') + ") VALUES (" + keys.map(function (s) {
        return typeof entity[s] === 'number' ? entity[s] : "'" + entity[s] + "'";
    }).join(',') + ")";
}
exports.generateReplaceSql = generateReplaceSql;
//# sourceMappingURL=SqlUtils.js.map