mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-15 04:22:09 +08:00
修改为支持自定义过滤
This commit is contained in:
@@ -12,7 +12,7 @@ public class SqlReadConstant {
|
||||
|
||||
public static final String SQL_PATTERN = "SELECT * FROM {} WHERE {}=?";
|
||||
|
||||
public static final String SQL_PATTERN_WITH_SUFFIX = "SELECT * FROM {} WHERE {}=? AND {} {} ?";
|
||||
public static final String SQL_PATTERN_WITH_SUFFIX = "SELECT * FROM {} WHERE {}=? AND {}";
|
||||
|
||||
public static final String SCRIPT_SQL_CHECK_PATTERN = "SELECT 1 FROM {} ";
|
||||
|
||||
|
||||
@@ -51,10 +51,6 @@ public abstract class AbstractSqlRead<T> implements SqlRead<T> {
|
||||
stmt.setFetchSize(SqlReadConstant.FETCH_SIZE_MAX);
|
||||
stmt.setString(1, config.getApplicationName());
|
||||
|
||||
if (sqlCmd.contains(config.getCustomFilterTypeField()) && StrUtil.isNotBlank(config.getCustomFilterType())) {
|
||||
stmt.setString(2, config.getCustomFilterType());
|
||||
}
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
|
||||
@@ -56,11 +56,11 @@ public class ChainRead extends AbstractSqlRead<ChainVO> {
|
||||
public String buildQuerySql() {
|
||||
String chainTableName = super.config.getChainTableName();
|
||||
String chainApplicationNameField = super.config.getChainApplicationNameField();
|
||||
String chainSuffixTypeField = super.config.getCustomFilterTypeField();
|
||||
String chainSuffixOperator = super.config.getCustomFilterOperator();
|
||||
if (StrUtil.isNotBlank(chainSuffixTypeField) && StrUtil.isNotBlank(chainSuffixOperator)) {
|
||||
String customFilterType = super.config.getCustomFilterType();
|
||||
|
||||
if (StrUtil.isNotBlank(customFilterType)) {
|
||||
return StrUtil.format(SqlReadConstant.SQL_PATTERN_WITH_SUFFIX, chainTableName,
|
||||
chainApplicationNameField, chainSuffixTypeField, chainSuffixOperator);
|
||||
chainApplicationNameField, customFilterType);
|
||||
} else {
|
||||
return StrUtil.format(SqlReadConstant.SQL_PATTERN, chainTableName, chainApplicationNameField);
|
||||
}
|
||||
|
||||
@@ -76,16 +76,6 @@ public class SQLParserVO {
|
||||
*/
|
||||
private String customFilterType;
|
||||
|
||||
/**
|
||||
* 自定义过滤操作符
|
||||
*/
|
||||
private String customFilterOperator;
|
||||
|
||||
/**
|
||||
* 自定义过滤字段名
|
||||
*/
|
||||
private String customFilterTypeField = "custom_filter_type";
|
||||
|
||||
/**
|
||||
* 脚本 node 表名
|
||||
*/
|
||||
@@ -359,20 +349,4 @@ public class SQLParserVO {
|
||||
public void setCustomFilterType(String customFilterType) {
|
||||
this.customFilterType = customFilterType;
|
||||
}
|
||||
|
||||
public String getCustomFilterTypeField() {
|
||||
return customFilterTypeField;
|
||||
}
|
||||
|
||||
public void setCustomFilterTypeField(String customFilterTypeField) {
|
||||
this.customFilterTypeField = customFilterTypeField;
|
||||
}
|
||||
|
||||
public String getCustomFilterOperator() {
|
||||
return customFilterOperator;
|
||||
}
|
||||
|
||||
public void setCustomFilterOperator(String customFilterOperator) {
|
||||
this.customFilterOperator = customFilterOperator;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user