RegistryCodeSqlBuilder

This commit is contained in:
ialbert 2024-08-05 12:40:46 +03:00
parent 10d6ad51f1
commit 761204b076
2 changed files with 24 additions and 10 deletions

View file

@ -0,0 +1,15 @@
package ru.spcex.platform.imdg.api.predicate.specific;
import java.util.List;
import ru.spcex.platform.enumeration.RegistryTradingParams;
public class RegistryCodeRawSqlBuilder extends RegistryCodeSqlBuilder {
RegistryCodeRawSqlBuilder(List<RegistryTradingParams> tradingParams) {
super(tradingParams);
registryDesignation = "registry_designation";
registryInstrumentType = "registry_instrument_type";
registryCapacity = "registry_capacity";
registryUnit = "registry_unit";
}
}

View file

@ -12,27 +12,26 @@ public class RegistryCodeSqlBuilder {
private List<RegistryTradingParams> registryTradingParams;
private String prefix = null;
private String registryDesignation = "registryDesignation";
private String registryInstrumentType = "registryInstrumentType";
private String registryCapacity = "registryCapacity";
private String registryUnit = "registryUnit";
protected String registryDesignation = "registryDesignation";
protected String registryInstrumentType = "registryInstrumentType";
protected String registryCapacity = "registryCapacity";
protected String registryUnit = "registryUnit";
public static RegistryCodeSqlBuilder getInstance(RegistryTradingParams... tradingParams) {
return getInstance(false, tradingParams);
}
public static RegistryCodeSqlBuilder getInstance(boolean directDB, RegistryTradingParams... tradingParams) {
RegistryCodeSqlBuilder builder = new RegistryCodeSqlBuilder(Arrays.asList(tradingParams));
RegistryCodeSqlBuilder builder;
if (directDB) {
builder.registryDesignation = "registry_designation";
builder.registryInstrumentType = "registry_instrument_type";
builder.registryCapacity = "registry_capacity";
builder.registryUnit = "registry_unit";
builder = new RegistryCodeRawSqlBuilder(Arrays.asList(tradingParams));
} else {
builder = new RegistryCodeSqlBuilder(Arrays.asList(tradingParams));
}
return builder;
}
private RegistryCodeSqlBuilder(List<RegistryTradingParams> tradingParams) {
RegistryCodeSqlBuilder(List<RegistryTradingParams> tradingParams) {
this.registryTradingParams = tradingParams;
}