"use strict";
/**
 * sql工具模块
 * @date 2022-03
 * @author 何华东
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.SqlUtils = void 0;
var SqlUtils = /** @class */ (function () {
    function SqlUtils() {
    }
    /**
      * 生成insert into sql语句
      */
    SqlUtils.generateInsertSql = function (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(',') + ")";
    };
    /**
     * 生成replace into sql语句
     */
    SqlUtils.generateReplaceSql = function (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(',') + ")";
    };
    return SqlUtils;
}());
exports.SqlUtils = SqlUtils;
exports.default = SqlUtils;
//# sourceMappingURL=SqlUtils.js.map