Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jz-dmp-cmdexectool
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姚本章
jz-dmp-cmdexectool
Commits
ef06f173
Commit
ef06f173
authored
Mar 08, 2021
by
sml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码提交
parent
addbcec1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
SqlParameters.java
.../cmdexectool/scheduler/common/task/sql/SqlParameters.java
+12
-7
transform_sql.ftl
src/main/resources/templates/transform_sql.ftl
+3
-0
No files found.
src/main/java/com/jz/dmp/cmdexectool/scheduler/common/task/sql/SqlParameters.java
View file @
ef06f173
...
...
@@ -188,8 +188,8 @@ public class SqlParameters extends AbstractParameters {
//transform
Map
<
String
,
String
>
transformSqlModel
=
new
HashMap
<
String
,
String
>();
transformSqlModel
.
put
(
"source_table_name"
,
"table_view"
);
transformSqlModel
.
put
(
"sql"
,
this
.
sqlScript
);
transformSqlModel
.
put
(
"table_name"
,
"t_view"
);
transform
=
FreeMarkerUtils
.
freemakerJson
(
CommConstant
.
WATERDROP_FTL_TRANSFORM_SQL
,
transformSqlModel
,
freeMarkerConfig
);
JSONObject
apiObj
=
scriptObj
.
getJSONObject
(
"api"
);
...
...
@@ -197,8 +197,9 @@ public class SqlParameters extends AbstractParameters {
String
sqlStr
=
ParameterUtils
.
columnMappingHandler
(
columnFieldsObj
);
Map
<
String
,
String
>
transformMappingSqlModel
=
new
HashMap
<
String
,
String
>();
transformSqlModel
.
put
(
"sql"
,
sqlStr
);
transform
=
transform
+
FreeMarkerUtils
.
freemakerJson
(
CommConstant
.
WATERDROP_FTL_TRANSFORM_JSON2
,
transformMappingSqlModel
,
freeMarkerConfig
);
transformMappingSqlModel
.
put
(
"source_table_name"
,
"table_view"
);
transformMappingSqlModel
.
put
(
"sql"
,
sqlStr
);
transform
=
transform
+
FreeMarkerUtils
.
freemakerJson
(
CommConstant
.
WATERDROP_FTL_TRANSFORM_SQL
,
transformMappingSqlModel
,
freeMarkerConfig
);
//sink
Map
<
String
,
String
>
sinkApiModel
=
new
HashMap
<
String
,
String
>();
...
...
@@ -227,6 +228,7 @@ public class SqlParameters extends AbstractParameters {
//transform
Map
<
String
,
String
>
transformSqlModel
=
new
HashMap
<
String
,
String
>();
transformSqlModel
.
put
(
"source_table_name"
,
"table_view"
);
transformSqlModel
.
put
(
"sql"
,
this
.
sqlScript
);
transform
=
FreeMarkerUtils
.
freemakerJson
(
CommConstant
.
WATERDROP_FTL_TRANSFORM_SQL
,
transformSqlModel
,
freeMarkerConfig
);
//sink
...
...
@@ -286,16 +288,17 @@ public class SqlParameters extends AbstractParameters {
//transform
Map
<
String
,
String
>
transformSqlModel
=
new
HashMap
<
String
,
String
>();
transformSqlModel
.
put
(
"source_table_name"
,
"table_view"
);
transformSqlModel
.
put
(
"sql"
,
this
.
sqlScript
);
transformSqlModel
.
put
(
"table_name"
,
"t_view"
);
transform
=
FreeMarkerUtils
.
freemakerJson
(
CommConstant
.
WATERDROP_FTL_TRANSFORM_SQL
,
transformSqlModel
,
freeMarkerConfig
);
String
tableFieldsObj
=
tableObj
.
getString
(
"tableFields"
);
String
sqlStr
=
ParameterUtils
.
columnMappingHandler
(
tableFieldsObj
);
Map
<
String
,
String
>
transformMappingSqlModel
=
new
HashMap
<
String
,
String
>();
transformSqlModel
.
put
(
"sql"
,
sqlStr
);
transform
=
transform
+
FreeMarkerUtils
.
freemakerJson
(
CommConstant
.
WATERDROP_FTL_TRANSFORM_JSON2
,
transformMappingSqlModel
,
freeMarkerConfig
);
transformMappingSqlModel
.
put
(
"source_table_name"
,
"table_view"
);
transformMappingSqlModel
.
put
(
"sql"
,
sqlStr
);
transform
=
transform
+
FreeMarkerUtils
.
freemakerJson
(
CommConstant
.
WATERDROP_FTL_TRANSFORM_SQL
,
transformMappingSqlModel
,
freeMarkerConfig
);
//sink
...
...
@@ -336,6 +339,7 @@ public class SqlParameters extends AbstractParameters {
//transform
Map
<
String
,
String
>
transformSqlModel
=
new
HashMap
<
String
,
String
>();
transformSqlModel
.
put
(
"source_table_name"
,
"table_view"
);
transformSqlModel
.
put
(
"sql"
,
this
.
sqlScript
);
transform
=
FreeMarkerUtils
.
freemakerJson
(
CommConstant
.
WATERDROP_FTL_TRANSFORM_SQL
,
transformSqlModel
,
freeMarkerConfig
);
//sink
...
...
@@ -362,6 +366,7 @@ public class SqlParameters extends AbstractParameters {
}
//transform
Map
<
String
,
String
>
transformSqlModel
=
new
HashMap
<
String
,
String
>();
transformSqlModel
.
put
(
"source_table_name"
,
"table_view"
);
transformSqlModel
.
put
(
"sql"
,
this
.
sqlScript
);
transform
=
FreeMarkerUtils
.
freemakerJson
(
CommConstant
.
WATERDROP_FTL_TRANSFORM_SQL
,
transformSqlModel
,
freeMarkerConfig
);
//sink
...
...
@@ -411,7 +416,7 @@ public class SqlParameters extends AbstractParameters {
Map
<
String
,
String
>
jdbcModel
=
new
HashMap
<
String
,
String
>();
jdbcModel
.
put
(
"driver"
,
dmpSyncingDatasource
.
getDriverClassName
());
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
(
"user"
,
user
);
jdbcModel
.
put
(
"password"
,
password
);
...
...
src/main/resources/templates/transform_sql.ftl
View file @
ef06f173
sql {
<#if source_table_name??>
source_table_name="${source_table_name!}"
</#if>
<#if sql??>
# sql语句,sql中的表名可以是Source或者Transform插件配置的result_table_name
sql = "${sql!}",
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment