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