dm-web-react
Version:
The DM web client with React.
132 lines (126 loc) • 7.25 kB
text/typescript
import { TableBase } from "./tableBase";
import { CreateTableTemplate } from "../../models/database/createTableTemplate";
import { TableInfo } from "../../models/database/tableInfo";
import { BrokerMarketBestPrice } from "../../models/entity/table/brokerMarketBestPrice";
export class BrokerMarketBestPriceTable extends TableBase {
public static readonly tableName: string = "brokerMarketBestPrice";
public static readonly serverTablename: string = "bond_quote_best_price_broker";
public static readonly version: number = 6; // any update need update verison;
private readonly columnNames: string[] = [];
constructor() {
super();
this.columnNames.push(this.getColumnName("dataId"));
this.columnNames.push(this.getColumnName("quoteId"));
this.columnNames.push(this.getColumnName("bondUniCode"));
this.columnNames.push(this.getColumnName("dmBondType"));
this.columnNames.push(this.getColumnName("issueDataTime"));
this.columnNames.push(this.getColumnName("brokerType"));
this.columnNames.push(this.getColumnName("bondCode"));
this.columnNames.push(this.getColumnName("brokerTypeValue"));
this.columnNames.push(this.getColumnName("bid"));
this.columnNames.push(this.getColumnName("bidValue"));
this.columnNames.push(this.getColumnName("bidVolume"));
this.columnNames.push(this.getColumnName("bidVolumeValue"));
this.columnNames.push(this.getColumnName("bidQuotStatusValue"));
this.columnNames.push(this.getColumnName("bidHintText"));
this.columnNames.push(this.getColumnName("bidShowHint"));
this.columnNames.push(this.getColumnName("ofr"));
this.columnNames.push(this.getColumnName("ofrValue"));
this.columnNames.push(this.getColumnName("ofrVolume"));
this.columnNames.push(this.getColumnName("ofrVolumeValue"));
this.columnNames.push(this.getColumnName("ofrQuotStatusValue"));
this.columnNames.push(this.getColumnName("ofrHintText"));
this.columnNames.push(this.getColumnName("ofrShowHint"));
this.columnNames.push(this.getColumnName("bidSubChinaBond"));
this.columnNames.push(this.getColumnName("bidSubChinaBondValue"));
this.columnNames.push(this.getColumnName("chinaBondSubOfr"));
this.columnNames.push(this.getColumnName("chinaBondSubOfrValue"));
this.columnNames.push(this.getColumnName("bidSubCsIndex"));
this.columnNames.push(this.getColumnName("bidSubCsIndexValue"));
this.columnNames.push(this.getColumnName("csIndexSubOfr"));
this.columnNames.push(this.getColumnName("csIndexSubOfrValue"));
this.columnNames.push(this.getColumnName("tradeSubChinaBond"));
this.columnNames.push(this.getColumnName("tradeSubChinaBondValue"));
this.columnNames.push(this.getColumnName("tradeSubCsIndex"));
this.columnNames.push(this.getColumnName("tradeSubCsIndexValue"));
this.columnNames.push(this.getColumnName("absBidSubOfrValue"));
this.columnNames.push(this.getColumnName("tenor"));
this.columnNames.push(this.getColumnName("tenorValue"));
this.columnNames.push(this.getColumnName("csIndex"));
this.columnNames.push(this.getColumnName("csIndexValue"));
this.columnNames.push(this.getColumnName("macd"));
this.columnNames.push(this.getColumnName("macdValue"));
this.columnNames.push(this.getColumnName("chinaBond"));
this.columnNames.push(this.getColumnName("chinaBondValue"));
}
private getColumnName(value: keyof BrokerMarketBestPrice): string {
return value.toString();
}
public getCreateTableTemplate(): CreateTableTemplate {
const createSql = `CREATE TABLE ${BrokerMarketBestPriceTable.tableName} (
${this.getColumnName("dataId")} VARCHAR(50) PRIMARY KEY,
${this.getColumnName("quoteId")} INTEGER,
${this.getColumnName("bondUniCode")} INTEGER,
${this.getColumnName("dmBondType")} VARCHAR(50),
${this.getColumnName("issueDataTime")} INTEGER,
${this.getColumnName("brokerType")} VARCHAR(50),
${this.getColumnName("bondCode")} VARCHAR(50),
${this.getColumnName("brokerTypeValue")} INTEGER,
${this.getColumnName("bid")} VARCHAR(50),
${this.getColumnName("bidValue")} DECIMAL(10,4),
${this.getColumnName("bidVolume")} VARCHAR(50),
${this.getColumnName("bidVolumeValue")} DECIMAL(10,4),
${this.getColumnName("bidQuotStatusValue")} INTEGER,
${this.getColumnName("bidHintText")} VARCHAR(100),
${this.getColumnName("bidShowHint")} INTEGER,
${this.getColumnName("ofr")} VARCHAR(50),
${this.getColumnName("ofrValue")} DECIMAL(10,4),
${this.getColumnName("ofrVolume")} VARCHAR(50),
${this.getColumnName("ofrVolumeValue")} DECIMAL(10,4),
${this.getColumnName("ofrQuotStatusValue")} INTEGER,
${this.getColumnName("ofrHintText")} VARCHAR(100),
${this.getColumnName("ofrShowHint")} INTEGER,
${this.getColumnName("bidSubChinaBond")} VARCHAR(50),
${this.getColumnName("bidSubChinaBondValue")} DECIMAL(10,4),
${this.getColumnName("chinaBondSubOfr")} VARCHAR(50),
${this.getColumnName("chinaBondSubOfrValue")} DECIMAL(10,4),
${this.getColumnName("bidSubCsIndex")} VARCHAR(50),
${this.getColumnName("bidSubCsIndexValue")} DECIMAL(10,4),
${this.getColumnName("csIndexSubOfr")} VARCHAR(50),
${this.getColumnName("csIndexSubOfrValue")} DECIMAL(10,4),
${this.getColumnName("tradeSubChinaBond")} VARCHAR(50),
${this.getColumnName("tradeSubChinaBondValue")} DECIMAL(10,4),
${this.getColumnName("tradeSubCsIndex")} VARCHAR(50),
${this.getColumnName("tradeSubCsIndexValue")} DECIMAL(10,4),
${this.getColumnName("absBidSubOfrValue")} DECIMAL(10,4),
${this.getColumnName("tenor")} VARCHAR(50),
${this.getColumnName("tenorValue")} INTEGER,
${this.getColumnName("csIndex")} VARCHAR(50),
${this.getColumnName("csIndexValue")} DECIMAL(10,4),
${this.getColumnName("macd")} VARCHAR(50),
${this.getColumnName("macdValue")} DECIMAL(10,4),
${this.getColumnName("chinaBond")} VARCHAR(50),
${this.getColumnName("chinaBondValue")} DECIMAL(10,4)
);
CREATE INDEX IF NOT EXISTS index_${BrokerMarketBestPriceTable.tableName}_${this.getColumnName("issueDataTime")} ON ${
BrokerMarketBestPriceTable.tableName
}(${this.getColumnName("issueDataTime")});
CREATE INDEX IF NOT EXISTS index_${BrokerMarketBestPriceTable.tableName}_${this.getColumnName("bidValue")} ON ${
BrokerMarketBestPriceTable.tableName
}(${this.getColumnName("bidValue")});
CREATE INDEX IF NOT EXISTS index_${BrokerMarketBestPriceTable.tableName}_${this.getColumnName("ofrValue")} ON ${
BrokerMarketBestPriceTable.tableName
}(${this.getColumnName("ofrValue")});`;
const result = new CreateTableTemplate();
result.createSql = createSql;
result.tableName = BrokerMarketBestPriceTable.tableName;
result.version = BrokerMarketBestPriceTable.version;
return result;
}
public getTableInfo(): TableInfo {
const result = new TableInfo();
result.tableName = BrokerMarketBestPriceTable.tableName;
result.columnNames = this.columnNames;
return result;
}
}