Commit ef06f173 authored by sml's avatar sml

代码提交

parent addbcec1
...@@ -188,8 +188,8 @@ public class SqlParameters extends AbstractParameters { ...@@ -188,8 +188,8 @@ public class SqlParameters extends AbstractParameters {
//transform //transform
Map<String, String> transformSqlModel = new HashMap<String, String>(); Map<String, String> transformSqlModel = new HashMap<String, String>();
transformSqlModel.put("source_table_name", "table_view");
transformSqlModel.put("sql", this.sqlScript); transformSqlModel.put("sql", this.sqlScript);
transformSqlModel.put("table_name", "t_view");
transform = FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_SQL, transformSqlModel, freeMarkerConfig); transform = FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_SQL, transformSqlModel, freeMarkerConfig);
JSONObject apiObj = scriptObj.getJSONObject("api"); JSONObject apiObj = scriptObj.getJSONObject("api");
...@@ -197,8 +197,9 @@ public class SqlParameters extends AbstractParameters { ...@@ -197,8 +197,9 @@ public class SqlParameters extends AbstractParameters {
String sqlStr = ParameterUtils.columnMappingHandler(columnFieldsObj); String sqlStr = ParameterUtils.columnMappingHandler(columnFieldsObj);
Map<String, String> transformMappingSqlModel = new HashMap<String, String>(); Map<String, String> transformMappingSqlModel = new HashMap<String, String>();
transformSqlModel.put("sql", sqlStr); transformMappingSqlModel.put("source_table_name", "table_view");
transform = transform + FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_JSON2, transformMappingSqlModel, freeMarkerConfig); transformMappingSqlModel.put("sql", sqlStr);
transform = transform + FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_SQL, transformMappingSqlModel, freeMarkerConfig);
//sink //sink
Map<String, String> sinkApiModel = new HashMap<String, String>(); Map<String, String> sinkApiModel = new HashMap<String, String>();
...@@ -227,6 +228,7 @@ public class SqlParameters extends AbstractParameters { ...@@ -227,6 +228,7 @@ public class SqlParameters extends AbstractParameters {
//transform //transform
Map<String, String> transformSqlModel = new HashMap<String, String>(); Map<String, String> transformSqlModel = new HashMap<String, String>();
transformSqlModel.put("source_table_name", "table_view");
transformSqlModel.put("sql", this.sqlScript); transformSqlModel.put("sql", this.sqlScript);
transform = FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_SQL, transformSqlModel, freeMarkerConfig); transform = FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_SQL, transformSqlModel, freeMarkerConfig);
//sink //sink
...@@ -286,16 +288,17 @@ public class SqlParameters extends AbstractParameters { ...@@ -286,16 +288,17 @@ public class SqlParameters extends AbstractParameters {
//transform //transform
Map<String, String> transformSqlModel = new HashMap<String, String>(); Map<String, String> transformSqlModel = new HashMap<String, String>();
transformSqlModel.put("source_table_name", "table_view");
transformSqlModel.put("sql", this.sqlScript); transformSqlModel.put("sql", this.sqlScript);
transformSqlModel.put("table_name", "t_view");
transform = FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_SQL, transformSqlModel, freeMarkerConfig); transform = FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_SQL, transformSqlModel, freeMarkerConfig);
String tableFieldsObj = tableObj.getString("tableFields"); String tableFieldsObj = tableObj.getString("tableFields");
String sqlStr = ParameterUtils.columnMappingHandler(tableFieldsObj); String sqlStr = ParameterUtils.columnMappingHandler(tableFieldsObj);
Map<String, String> transformMappingSqlModel = new HashMap<String, String>(); Map<String, String> transformMappingSqlModel = new HashMap<String, String>();
transformSqlModel.put("sql", sqlStr); transformMappingSqlModel.put("source_table_name", "table_view");
transform = transform + FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_JSON2, transformMappingSqlModel, freeMarkerConfig); transformMappingSqlModel.put("sql", sqlStr);
transform = transform + FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_SQL, transformMappingSqlModel, freeMarkerConfig);
//sink //sink
...@@ -336,6 +339,7 @@ public class SqlParameters extends AbstractParameters { ...@@ -336,6 +339,7 @@ public class SqlParameters extends AbstractParameters {
//transform //transform
Map<String, String> transformSqlModel = new HashMap<String, String>(); Map<String, String> transformSqlModel = new HashMap<String, String>();
transformSqlModel.put("source_table_name", "table_view");
transformSqlModel.put("sql", this.sqlScript); transformSqlModel.put("sql", this.sqlScript);
transform = FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_SQL, transformSqlModel, freeMarkerConfig); transform = FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_SQL, transformSqlModel, freeMarkerConfig);
//sink //sink
...@@ -362,6 +366,7 @@ public class SqlParameters extends AbstractParameters { ...@@ -362,6 +366,7 @@ public class SqlParameters extends AbstractParameters {
} }
//transform //transform
Map<String, String> transformSqlModel = new HashMap<String, String>(); Map<String, String> transformSqlModel = new HashMap<String, String>();
transformSqlModel.put("source_table_name", "table_view");
transformSqlModel.put("sql", this.sqlScript); transformSqlModel.put("sql", this.sqlScript);
transform = FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_SQL, transformSqlModel, freeMarkerConfig); transform = FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_SQL, transformSqlModel, freeMarkerConfig);
//sink //sink
...@@ -411,7 +416,7 @@ public class SqlParameters extends AbstractParameters { ...@@ -411,7 +416,7 @@ public class SqlParameters extends AbstractParameters {
Map<String, String> jdbcModel = new HashMap<String, String>(); Map<String, String> jdbcModel = new HashMap<String, String>();
jdbcModel.put("driver", dmpSyncingDatasource.getDriverClassName()); jdbcModel.put("driver", dmpSyncingDatasource.getDriverClassName());
jdbcModel.put("url", jdbcUrl); jdbcModel.put("url", jdbcUrl);
jdbcModel.put("table", "("+this.sqlScript+") as table_view"); jdbcModel.put("table", this.sqlScript);
jdbcModel.put("result_table_name", "table_view"); jdbcModel.put("result_table_name", "table_view");
jdbcModel.put("user", user); jdbcModel.put("user", user);
jdbcModel.put("password", password); jdbcModel.put("password", password);
......
sql { sql {
<#if source_table_name??>
source_table_name="${source_table_name!}"
</#if>
<#if sql??> <#if sql??>
# sql语句,sql中的表名可以是Source或者Transform插件配置的result_table_name # sql语句,sql中的表名可以是Source或者Transform插件配置的result_table_name
sql = "${sql!}", sql = "${sql!}",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment