mirror of
https://github.com/WeiYe-Jing/datax-web.git
synced 2026-07-03 21:08:58 +08:00
add: writer 增加 preSql 属性构建
This commit is contained in:
parent
ebf9caff51
commit
be109eceec
@ -34,4 +34,5 @@ public class DataxJsonDto implements Serializable {
|
||||
|
||||
private String querySql;
|
||||
|
||||
private String preSql;
|
||||
}
|
||||
|
||||
@ -50,6 +50,7 @@ public class DataxJsonServiceImpl implements DataxJsonService {
|
||||
} else {
|
||||
JobJdbcDatasource writerDatasource = jobJdbcDatasourceService.getById(dataxJsonDto.getWriterDatasourceId());
|
||||
dataxJsonHelper.initWriter(writerDatasource, dataxJsonDto.getWriterTables(), dataxJsonDto.getWriterColumns());
|
||||
dataxJsonHelper.setPreSql(dataxJsonDto.getPreSql());
|
||||
}
|
||||
|
||||
return JSON.toJSONString(dataxJsonHelper.buildJob());
|
||||
|
||||
@ -63,6 +63,8 @@ public class DataxJsonHelper implements DataxJsonInterface {
|
||||
|
||||
private String querySql;
|
||||
|
||||
private String preSql;
|
||||
|
||||
private BaseDataxPlugin readerPlugin;
|
||||
|
||||
private BaseDataxPlugin writerPlugin;
|
||||
@ -156,6 +158,7 @@ public class DataxJsonHelper implements DataxJsonInterface {
|
||||
dataxPluginPojo.setJdbcDatasource(writerDatasource);
|
||||
dataxPluginPojo.setTables(writerTables);
|
||||
dataxPluginPojo.setColumns(writerColumns);
|
||||
dataxPluginPojo.setPreSql(preSql);
|
||||
|
||||
return writerPlugin.build(dataxPluginPojo);
|
||||
}
|
||||
@ -171,4 +174,8 @@ public class DataxJsonHelper implements DataxJsonInterface {
|
||||
public void setQuerySql(String querySql) {
|
||||
this.querySql = querySql;
|
||||
}
|
||||
|
||||
public void setPreSql(String preSql) {
|
||||
this.preSql = preSql;
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,6 +31,9 @@ public abstract class BaseWriterPlugin extends BaseDataxPlugin {
|
||||
|
||||
parameterObj.put("column", dataxPluginPojo.getColumns());
|
||||
|
||||
// preSql
|
||||
parameterObj.put("preSql", ImmutableList.of(dataxPluginPojo.getPreSql()));
|
||||
|
||||
Map<String, Object> connectionObj = Maps.newLinkedHashMap();
|
||||
connectionObj.put("table", dataxPluginPojo.getTables());
|
||||
|
||||
|
||||
@ -35,4 +35,9 @@ public class DataxPluginPojo {
|
||||
* querySql 属性,如果指定了,则优先于columns参数
|
||||
*/
|
||||
private String querySql;
|
||||
|
||||
/**
|
||||
* preSql 属性
|
||||
*/
|
||||
private String preSql;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user