"use strict";
/**
 * 统一对内接口SQL通道接口模块
 * @date 2022-03
 * @author 何华东
 */
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TySqlApiClient = exports.generateTySqlApiClient = void 0;
var typescript_ioc_1 = require("typescript-ioc");
var TyInternalApi_1 = require("./TyInternalApi");
var Errors_1 = require("./Errors");
var SqlUtils_1 = require("./SqlUtils");
/**
 * SQL通道API客户端类
 *
 * ```ts
 * import { Singleton, Inject } from "typescript-ioc";
 * import { IService } from "mslib"
 * import { TyApi, TyExternalApi, ApiResponse, generateTySqlApiClient } from "refs/nslib";
 *
 * export class PostCarInInfo implements IService {
 *    //去掉注释
 *    //@TyApi.Service()
 *    async doService(input: TyExternalApi.PostCarInInfoInput): Promise<ApiResponse> {
 *        let sqlApiClient = generateTySqlApiClient(123456);
 *        let row = sqlApiClient.selectOne('select * from t_2014_config limit 1');
 *        let roww = sqlApiClient.list('select * from t_2014_config');
 *
 *        return ApiResponse.success;
 *    }
 * }
 * ```
 */
var TySqlApiClient = /** @class */ (function () {
    function TySqlApiClient() {
        /**
         * 车场端区域信息
         */
        this.area = new /** @class */ (function () {
            function class_1(outer) {
                this.outer = outer;
            }
            class_1.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_area"; };
            class_1.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_1;
        }())(this);
        /**
         * 车场端区域判断
         */
        this.area_node = new /** @class */ (function () {
            function class_2(outer) {
                this.outer = outer;
            }
            class_2.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_area_node"; };
            class_2.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_2;
        }())(this);
        /**
         * 内部车审核
         */
        this.audit = new /** @class */ (function () {
            function class_3(outer) {
                this.outer = outer;
            }
            class_3.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_audit"; };
            class_3.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_3;
        }())(this);
        /**
         *
         */
        this.autotoller = new /** @class */ (function () {
            function class_4(outer) {
                this.outer = outer;
            }
            class_4.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_autotoller"; };
            return class_4;
        }())(this);
        /**
         * 数据备份记录
         */
        this.backup_log = new /** @class */ (function () {
            function class_5(outer) {
                this.outer = outer;
            }
            class_5.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_backup_log"; };
            class_5.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_5;
        }())(this);
        /**
         * 账单主表
         */
        this.car_bill = new /** @class */ (function () {
            function class_6(outer) {
                this.outer = outer;
            }
            class_6.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_car_bill"; };
            class_6.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = '" + id + "' LIMIT 1")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_6;
        }())(this);
        /**
         * 找零明细表
         */
        this.car_bill_change_detail = new /** @class */ (function () {
            function class_7(outer) {
                this.outer = outer;
            }
            class_7.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_car_bill_change_detail"; };
            class_7.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = '" + id + "' LIMIT 1")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            class_7.prototype.getListByBillId = function (billId) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.list("SELECT * FROM " + this.getTableName() + " WHERE billId = '" + billId + "'")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_7;
        }())(this);
        /**
         * 抵用券使用表
         */
        this.car_bill_coupon = new /** @class */ (function () {
            function class_8(outer) {
                this.outer = outer;
            }
            class_8.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_car_bill_coupon"; };
            class_8.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = '" + id + "' LIMIT 1")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            class_8.prototype.getListByBillId = function (billId) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.list("SELECT * FROM " + this.getTableName() + " WHERE billId = '" + billId + "'")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_8;
        }())(this);
        /**
         * 账单明细表
         */
        this.car_bill_detail = new /** @class */ (function () {
            function class_9(outer) {
                this.outer = outer;
            }
            class_9.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_car_bill_detail"; };
            class_9.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = '" + id + "' LIMIT 1")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            class_9.prototype.getListByBillId = function (billId) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.list("SELECT * FROM " + this.getTableName() + " WHERE billId = '" + billId + "'")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_9;
        }())(this);
        /**
         *
         */
        this.car_bill_order = new /** @class */ (function () {
            function class_10(outer) {
                this.outer = outer;
            }
            class_10.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_car_bill_order"; };
            class_10.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = '" + id + "' LIMIT 1")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            class_10.prototype.getListByBillId = function (billId) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.list("SELECT * FROM " + this.getTableName() + " WHERE billId = '" + billId + "'")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_10;
        }())(this);
        /**
         *
         */
        this.car_bill_recover = new /** @class */ (function () {
            function class_11(outer) {
                this.outer = outer;
            }
            class_11.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_car_bill_recover"; };
            class_11.prototype.getListByBillId = function (billId) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.list("SELECT * FROM " + this.getTableName() + " WHERE billId = '" + billId + "'")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_11;
        }())(this);
        /**
         *
         */
        this.car_blacklist = new /** @class */ (function () {
            function class_12(outer) {
                this.outer = outer;
            }
            class_12.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_car_blacklist"; };
            class_12.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_12;
        }())(this);
        /**
         *
         */
        this.car_blacklist_modify = new /** @class */ (function () {
            function class_13(outer) {
                this.outer = outer;
            }
            class_13.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_car_blacklist_modify"; };
            class_13.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_13;
        }())(this);
        /**
         * 车辆信息矫正表
         */
        this.car_correct = new /** @class */ (function () {
            function class_14(outer) {
                this.outer = outer;
            }
            class_14.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_car_correct"; };
            class_14.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_14;
        }())(this);
        /**
         * 进出车辆图片扩展表
         */
        this.car_img_ext = new /** @class */ (function () {
            function class_15(outer) {
                this.outer = outer;
            }
            class_15.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_car_img_ext"; };
            class_15.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            class_15.prototype.getListByBillId = function (billId) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.list("SELECT * FROM " + this.getTableName() + " WHERE billId = '" + billId + "'")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_15;
        }())(this);
        /**
         * 车辆进出明细表
         */
        this.car_inout = new /** @class */ (function () {
            function class_16(outer) {
                this.outer = outer;
            }
            class_16.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_car_inout"; };
            class_16.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            class_16.prototype.getListByBillId = function (billId) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.list("SELECT * FROM " + this.getTableName() + " WHERE billId = '" + billId + "'")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            class_16.prototype.where = function (where) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.list("SELECT * FROM " + this.getTableName() + " " + where)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_16;
        }())(this);
        /**
         * 车辆清理审核表  备份被清理车辆信息
         */
        this.car_leave_audit = new /** @class */ (function () {
            function class_17(outer) {
                this.outer = outer;
            }
            class_17.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_car_leave_audit"; };
            class_17.prototype.getListByBillId = function (billId) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.list("SELECT * FROM " + this.getTableName() + " WHERE billId = '" + billId + "'")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_17;
        }())(this);
        /**
         * 车辆在场表
         */
        this.carcome = new /** @class */ (function () {
            function class_18(outer) {
                this.outer = outer;
            }
            class_18.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_carcome"; };
            class_18.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            class_18.prototype.getListByBillId = function (billId) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.list("SELECT * FROM " + this.getTableName() + " WHERE billId = '" + billId + "'")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_18;
        }())(this);
        /**
         * 主卡表内部车
         */
        this.card = new /** @class */ (function () {
            function class_19(outer) {
                this.outer = outer;
            }
            class_19.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_card"; };
            class_19.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            class_19.prototype.assist = function (assist) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE assist = '" + assist + "' ")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_19;
        }())(this);
        /**
         * 内部车审核表
         */
        this.card_audit = new /** @class */ (function () {
            function class_20(outer) {
                this.outer = outer;
            }
            class_20.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_card_audit"; };
            class_20.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_20;
        }())(this);
        /**
         * 内部车卡片车辆明细
         */
        this.card_car = new /** @class */ (function () {
            function class_21(outer) {
                this.outer = outer;
            }
            class_21.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_card_car"; };
            class_21.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_21;
        }())(this);
        /**
         *
         */
        this.card_car_audit = new /** @class */ (function () {
            function class_22(outer) {
                this.outer = outer;
            }
            class_22.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_card_car_audit"; };
            class_22.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_22;
        }())(this);
        /**
         *
         */
        this.card_car_blacklist = new /** @class */ (function () {
            function class_23(outer) {
                this.outer = outer;
            }
            class_23.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_card_car_blacklist"; };
            class_23.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_23;
        }())(this);
        /**
         *
         */
        this.card_fee_rule = new /** @class */ (function () {
            function class_24(outer) {
                this.outer = outer;
            }
            class_24.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_card_fee_rule"; };
            class_24.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_24;
        }())(this);
        /**
         *
         */
        this.card_log = new /** @class */ (function () {
            function class_25(outer) {
                this.outer = outer;
            }
            class_25.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_card_log"; };
            class_25.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_25;
        }())(this);
        /**
         *
         */
        this.card_log_audit = new /** @class */ (function () {
            function class_26(outer) {
                this.outer = outer;
            }
            class_26.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_card_log_audit"; };
            class_26.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_26;
        }())(this);
        /**
         *
         */
        this.card_lot = new /** @class */ (function () {
            function class_27(outer) {
                this.outer = outer;
            }
            class_27.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_card_lot"; };
            class_27.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_27;
        }())(this);
        /**
         *
         */
        this.card_lot_area = new /** @class */ (function () {
            function class_28(outer) {
                this.outer = outer;
            }
            class_28.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_card_lot_area"; };
            class_28.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_28;
        }())(this);
        /**
         *
         */
        this.card_lot_area_audit = new /** @class */ (function () {
            function class_29(outer) {
                this.outer = outer;
            }
            class_29.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_card_lot_area_audit"; };
            class_29.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_29;
        }())(this);
        /**
         *
         */
        this.card_lot_audit = new /** @class */ (function () {
            function class_30(outer) {
                this.outer = outer;
            }
            class_30.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_card_lot_audit"; };
            class_30.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_30;
        }())(this);
        /**
         *
         */
        this.card_temp = new /** @class */ (function () {
            function class_31(outer) {
                this.outer = outer;
            }
            class_31.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_card_temp"; };
            class_31.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_31;
        }())(this);
        /**
         *
         */
        this.card_validtime = new /** @class */ (function () {
            function class_32(outer) {
                this.outer = outer;
            }
            class_32.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_card_validtime"; };
            class_32.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_32;
        }())(this);
        /**
         *
         */
        this.card_validtime_audit = new /** @class */ (function () {
            function class_33(outer) {
                this.outer = outer;
            }
            class_33.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_card_validtime_audit"; };
            class_33.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_33;
        }())(this);
        /**
         *
         */
        this.config = new /** @class */ (function () {
            function class_34(outer) {
                this.outer = outer;
            }
            class_34.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_config"; };
            /**
             * 查找非标配置
             */
            class_34.prototype.findNsConfig = function (name) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE session = 'nsConfig' AND name = '" + name + "' LIMIT 1")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            /**
             * 查找非标配置值
             */
            class_34.prototype.findNsConfigValue = function (name) {
                return __awaiter(this, void 0, void 0, function () {
                    var config;
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.findNsConfig(name)];
                            case 1:
                                config = _a.sent();
                                return [2 /*return*/, config === null || config === void 0 ? void 0 : config.value];
                        }
                    });
                });
            };
            /**
             * 获取非标配置列表
             * @param name 可按name前缀匹配
             */
            class_34.prototype.getNsConfigList = function (name) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.list("SELECT * FROM " + this.getTableName() + " WHERE session = 'nsConfig' " + (name ? "AND name like '" + name + "%'" : ''))];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_34;
        }())(this);
        /**
         *
         */
        this.credible_user = new /** @class */ (function () {
            function class_35(outer) {
                this.outer = outer;
            }
            class_35.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_credible_user"; };
            class_35.prototype.getListByBillId = function (billId) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.list("SELECT * FROM " + this.getTableName() + " WHERE billId = '" + billId + "'")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_35;
        }())(this);
        /**
         *
         */
        this.device = new /** @class */ (function () {
            function class_36(outer) {
                this.outer = outer;
            }
            class_36.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_device"; };
            return class_36;
        }())(this);
        /**
         *
         */
        this.device_cfg = new /** @class */ (function () {
            function class_37(outer) {
                this.outer = outer;
            }
            class_37.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_device_cfg"; };
            return class_37;
        }())(this);
        /**
         *
         */
        this.dict = new /** @class */ (function () {
            function class_38(outer) {
                this.outer = outer;
            }
            class_38.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_dict"; };
            class_38.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_38;
        }())(this);
        /**
         * 显示屏模板的显示内容
         */
        this.display_content = new /** @class */ (function () {
            function class_39(outer) {
                this.outer = outer;
            }
            class_39.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_display_content"; };
            class_39.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_39;
        }())(this);
        /**
         * 显示屏模板元素
         */
        this.display_element = new /** @class */ (function () {
            function class_40(outer) {
                this.outer = outer;
            }
            class_40.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_display_element"; };
            class_40.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_40;
        }())(this);
        /**
         * 显示屏模板元素标签
         */
        this.display_element_type = new /** @class */ (function () {
            function class_41(outer) {
                this.outer = outer;
            }
            class_41.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_display_element_type"; };
            class_41.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_41;
        }())(this);
        /**
         * 显示屏模板
         */
        this.display_template = new /** @class */ (function () {
            function class_42(outer) {
                this.outer = outer;
            }
            class_42.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_display_template"; };
            class_42.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_42;
        }())(this);
        /**
         *
         */
        this.drawback = new /** @class */ (function () {
            function class_43(outer) {
                this.outer = outer;
            }
            class_43.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_drawback"; };
            class_43.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_43;
        }())(this);
        /**
         * 退款审核表
         */
        this.drawback_audit = new /** @class */ (function () {
            function class_44(outer) {
                this.outer = outer;
            }
            class_44.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_drawback_audit"; };
            class_44.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_44;
        }())(this);
        /**
         *
         */
        this.fee_available = new /** @class */ (function () {
            function class_45(outer) {
                this.outer = outer;
            }
            class_45.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_fee_available"; };
            class_45.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_45;
        }())(this);
        /**
         * 计费规则时间分组
         */
        this.fee_date_group = new /** @class */ (function () {
            function class_46(outer) {
                this.outer = outer;
            }
            class_46.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_fee_date_group"; };
            class_46.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_46;
        }())(this);
        /**
         *
         */
        this.fee_specialdates = new /** @class */ (function () {
            function class_47(outer) {
                this.outer = outer;
            }
            class_47.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_fee_specialdates"; };
            class_47.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_47;
        }())(this);
        /**
         *
         */
        this.fee_static = new /** @class */ (function () {
            function class_48(outer) {
                this.outer = outer;
            }
            class_48.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_fee_static"; };
            class_48.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_48;
        }())(this);
        /**
         *
         */
        this.fee_type = new /** @class */ (function () {
            function class_49(outer) {
                this.outer = outer;
            }
            class_49.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_fee_type"; };
            class_49.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_49;
        }())(this);
        /**
         *
         */
        this.last_carout = new /** @class */ (function () {
            function class_50(outer) {
                this.outer = outer;
            }
            class_50.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_last_carout"; };
            class_50.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_50;
        }())(this);
        /**
         * 终端缴费设备现金状态表
         */
        this.machine_cash = new /** @class */ (function () {
            function class_51(outer) {
                this.outer = outer;
            }
            class_51.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_machine_cash"; };
            class_51.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_51;
        }())(this);
        /**
         * 商家充值记录表
         */
        this.merchant_recharge = new /** @class */ (function () {
            function class_52(outer) {
                this.outer = outer;
            }
            class_52.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_merchant_recharge"; };
            class_52.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_52;
        }())(this);
        /**
         *
         */
        this.modify_carno = new /** @class */ (function () {
            function class_53(outer) {
                this.outer = outer;
            }
            class_53.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_modify_carno"; };
            class_53.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = '" + id + "' LIMIT 1")];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_53;
        }())(this);
        /**
         *
         */
        this.node = new /** @class */ (function () {
            function class_54(outer) {
                this.outer = outer;
            }
            class_54.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_node"; };
            class_54.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_54;
        }())(this);
        /**
         *
         */
        this.node_control = new /** @class */ (function () {
            function class_55(outer) {
                this.outer = outer;
            }
            class_55.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_node_control"; };
            class_55.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_55;
        }())(this);
        /**
         *
         */
        this.node_device = new /** @class */ (function () {
            function class_56(outer) {
                this.outer = outer;
            }
            class_56.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_node_device"; };
            return class_56;
        }())(this);
        /**
         * 通道自由流开启日志
         */
        this.node_free_log = new /** @class */ (function () {
            function class_57(outer) {
                this.outer = outer;
            }
            class_57.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_node_free_log"; };
            class_57.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_57;
        }())(this);
        /**
         * 车道控制配置表
         */
        this.node_plan = new /** @class */ (function () {
            function class_58(outer) {
                this.outer = outer;
            }
            class_58.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_node_plan"; };
            class_58.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_58;
        }())(this);
        /**
         * 离线模式报表数据量汇总表
         */
        this.offline_tab_count = new /** @class */ (function () {
            function class_59(outer) {
                this.outer = outer;
            }
            class_59.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_offline_tab_count"; };
            return class_59;
        }())(this);
        /**
         *
         */
        this.park = new /** @class */ (function () {
            function class_60(outer) {
                this.outer = outer;
            }
            class_60.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_park"; };
            return class_60;
        }())(this);
        /**
         * 预约车表
         */
        this.parking_booking = new /** @class */ (function () {
            function class_61(outer) {
                this.outer = outer;
            }
            class_61.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_parking_booking"; };
            class_61.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_61;
        }())(this);
        /**
         *
         */
        this.realtime_data = new /** @class */ (function () {
            function class_62(outer) {
                this.outer = outer;
            }
            class_62.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_realtime_data"; };
            return class_62;
        }())(this);
        /**
         * 内部车预约车权限管理表
         */
        this.role_area = new /** @class */ (function () {
            function class_63(outer) {
                this.outer = outer;
            }
            class_63.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_role_area"; };
            class_63.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_63;
        }())(this);
        /**
         * 找车系统同步的区域信息
         */
        this.search_car_area = new /** @class */ (function () {
            function class_64(outer) {
                this.outer = outer;
            }
            class_64.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_search_car_area"; };
            class_64.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_64;
        }())(this);
        /**
         * 找车系统区域和系统区域关系
         */
        this.search_car_area_bind = new /** @class */ (function () {
            function class_65(outer) {
                this.outer = outer;
            }
            class_65.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_search_car_area_bind"; };
            class_65.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_65;
        }())(this);
        /**
         *
         */
        this.special_car = new /** @class */ (function () {
            function class_66(outer) {
                this.outer = outer;
            }
            class_66.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_special_car"; };
            class_66.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_66;
        }())(this);
        /**
         *
         */
        this.tab_allsync_assist = new /** @class */ (function () {
            function class_67(outer) {
                this.outer = outer;
            }
            class_67.prototype.getTableName = function () { return "t_" + this.outer.parkId + "_tab_allsync_assist"; };
            return class_67;
        }())(this);
        /**
         *
         */
        this.clear_money = new /** @class */ (function () {
            function class_68(outer) {
                this.outer = outer;
            }
            class_68.prototype.getTableName = function () { return "tp_" + this.outer.parkId + "_clear_money"; };
            class_68.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_68;
        }())(this);
        /**
         * 终端班次表
         */
        this.duty_detail = new /** @class */ (function () {
            function class_69(outer) {
                this.outer = outer;
            }
            class_69.prototype.getTableName = function () { return "tp_" + this.outer.parkId + "_duty_detail"; };
            class_69.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_69;
        }())(this);
        /**
         *
         */
        this.file = new /** @class */ (function () {
            function class_70(outer) {
                this.outer = outer;
            }
            class_70.prototype.getTableName = function () { return "tp_" + this.outer.parkId + "_file"; };
            class_70.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_70;
        }())(this);
        /**
         * 临时表，仅用于车场初始化校验表结构是否初始化成功用的
         */
        this.init_temp = new /** @class */ (function () {
            function class_71(outer) {
                this.outer = outer;
            }
            class_71.prototype.getTableName = function () { return "tp_" + this.outer.parkId + "_init_temp"; };
            class_71.prototype.find = function (id) {
                return __awaiter(this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0: return [4 /*yield*/, this.outer.selectOne("SELECT * FROM " + this.getTableName() + " WHERE id = " + id)];
                            case 1: return [2 /*return*/, _a.sent()];
                        }
                    });
                });
            };
            return class_71;
        }())(this);
    }
    TySqlApiClient.prototype.selectOne = function (sql) {
        return __awaiter(this, void 0, void 0, function () {
            var request;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        request = new TyInternalApi_1.SelectOneRequest();
                        request.parkId = this.parkId;
                        request.sql = sql;
                        return [4 /*yield*/, this.internalApiClient.selectOne(request)];
                    case 1: return [2 /*return*/, _a.sent()];
                }
            });
        });
    };
    TySqlApiClient.prototype.list = function (sql) {
        return __awaiter(this, void 0, void 0, function () {
            var request;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        request = new TyInternalApi_1.ListRequest();
                        request.parkId = this.parkId;
                        request.sql = sql;
                        return [4 /*yield*/, this.internalApiClient.list(request)];
                    case 1: return [2 /*return*/, _a.sent()];
                }
            });
        });
    };
    TySqlApiClient.prototype.execute = function (sql, openTx) {
        return __awaiter(this, void 0, void 0, function () {
            var request;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        request = new TyInternalApi_1.ExecuteRequest();
                        request.parkId = this.parkId;
                        request.sqlList = Array.isArray(sql) ? sql : [sql];
                        request.openTx = openTx;
                        return [4 /*yield*/, this.internalApiClient.execute(request)];
                    case 1: return [2 /*return*/, _a.sent()];
                }
            });
        });
    };
    TySqlApiClient.prototype.insert = function (type, entity) {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, this.execute([SqlUtils_1.default.generateInsertSql("t_" + this.parkId + "_" + type.name, entity)])];
                    case 1: return [2 /*return*/, _a.sent()];
                }
            });
        });
    };
    TySqlApiClient.prototype.replace = function (type, entity) {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, this.execute([SqlUtils_1.default.generateReplaceSql("t_" + this.parkId + "_" + type.name, entity)])];
                    case 1: return [2 /*return*/, _a.sent()];
                }
            });
        });
    };
    __decorate([
        typescript_ioc_1.Inject,
        __metadata("design:type", TyInternalApi_1.TyInternalApiClient)
    ], TySqlApiClient.prototype, "internalApiClient", void 0);
    return TySqlApiClient;
}());
exports.TySqlApiClient = TySqlApiClient;
exports.default = TySqlApiClient;
/**
 * 生成指定车场的TySqlApiClient实例
 *
 * ```ts
 * import { Singleton, Inject } from "typescript-ioc";
 * import { IService } from "mslib"
 * import { TyApi, TyExternalApi, ApiResponse, generateTySqlApiClient } from "refs/nslib";
 *
 * export class PostCarInInfo implements IService {
 *    //去掉注释
 *    //@TyApi.Service()
 *    async doService(input: TyExternalApi.PostCarInInfoInput): Promise<ApiResponse> {
 *        let client = generateTySqlApiClient(123456);
 *        let row = client.selectOne('select * from t_2014_config limit 1');
 *        let roww = client.list('select * from t_2014_config');
 *
 *        return ApiResponse.success;
 *    }
 * }
 * ```
 */
function generateTySqlApiClient(parkId) {
    if (!parkId)
        throw new Errors_1.ParamEmptyError('parkId');
    var sqlApiClient = typescript_ioc_1.Container.get(TySqlApiClient);
    sqlApiClient.parkId = parkId;
    return sqlApiClient;
}
exports.generateTySqlApiClient = generateTySqlApiClient;
//# sourceMappingURL=TySqlApiClient.js.map