|
@ -99,7 +99,8 @@ public class Mysql2ESJob implements Job {
|
|
|
//1抽取数据
|
|
|
String sql = this.flJobConfig.getSql();
|
|
|
String sqlFiled = this.flJobConfig.getSqlField();
|
|
|
this.finalSql = getJobConfigSql(sql,sqlFiled,sqlFiledCondition,sqlFiledValue);
|
|
|
// this.finalSql = getJobConfigSql(sql,sqlFiled,sqlFiledCondition,sqlFiledValue);
|
|
|
this.finalSql = getFinalSql(sql,sqlFiled,sqlFiledCondition,sqlFiledValue);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -178,7 +179,13 @@ public class Mysql2ESJob implements Job {
|
|
|
result.append(" where ").append(sqlFiledString.toString());
|
|
|
}
|
|
|
|
|
|
/*if (sqlFiledValue.contains(",") && sql.contains("where")) {
|
|
|
return result.toString();
|
|
|
}
|
|
|
|
|
|
public String getFinalSql(String sql, String sqlFiled, String sqlFiledCondition, String sqlFiledValue) {
|
|
|
StringBuilder result = new StringBuilder();
|
|
|
result.append(sql).append(" ");
|
|
|
if (sqlFiledValue.contains(",") && sql.contains("where")) {
|
|
|
String[] sqlFiledValues = sqlFiledValue.split(",");
|
|
|
result.append("and ").append(sqlFiled).append(sqlFiledCondition).append("\'"+sqlFiledValues[1]+"\'").append(" and ").append(sqlFiled).append(sqlFiledCondition).append("\'"+sqlFiledValues[0]+"\'");
|
|
|
}else if(sql.contains("where")){
|
|
@ -189,9 +196,8 @@ public class Mysql2ESJob implements Job {
|
|
|
result.replace(result.indexOf("$"),result.indexOf("$")+1,otherCondition.toString());
|
|
|
}else {
|
|
|
result.append("where ").append(sqlFiled).append(sqlFiledCondition).append("\'"+sqlFiledValue+"\'");
|
|
|
}*/
|
|
|
}
|
|
|
return result.toString();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|