mirror of
https://github.com/WeiYe-Jing/datax-web.git
synced 2026-06-21 21:03:09 +08:00
更新mongodb构建json
This commit is contained in:
parent
b828947fe2
commit
f2ada5591f
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,3 +11,4 @@
|
||||
/datax-registry/target/
|
||||
/datax-rpc/datax-rpc.iml
|
||||
/datax-rpc/target/
|
||||
/datax-all.iml
|
||||
@ -21,12 +21,6 @@ public class MongoDBWriterDto implements Serializable {
|
||||
|
||||
private String collectionName;
|
||||
|
||||
/**
|
||||
* 当设置为true时,表示针对相同的upsertKey做更新操作
|
||||
*/
|
||||
private boolean isUpsert;
|
||||
/**
|
||||
* upsertKey指定了没行记录的业务主键。用来做更新时使用。
|
||||
*/
|
||||
private String upsertKey;
|
||||
private UpsertInfo upsertInfo;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package com.wugui.datax.admin.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Created by mac on 2020/3/16.
|
||||
*/
|
||||
@Data
|
||||
public class UpsertInfo {
|
||||
/**
|
||||
* 当设置为true时,表示针对相同的upsertKey做更新操作
|
||||
*/
|
||||
private boolean isUpsert;
|
||||
/**
|
||||
* upsertKey指定了没行记录的业务主键。用来做更新时使用。
|
||||
*/
|
||||
private String upsertKey;
|
||||
}
|
||||
@ -323,8 +323,8 @@ public class DataxJsonHelper implements DataxJsonInterface {
|
||||
dataxMongoDBPojo.setAddress(writerDatasource.getJdbcUrl());
|
||||
dataxMongoDBPojo.setDbName(mongoDBWriterDto.getDbName());
|
||||
dataxMongoDBPojo.setCollectionName(mongoDBWriterDto.getCollectionName());
|
||||
dataxMongoDBPojo.setUpsert(mongoDBWriterDto.isUpsert());
|
||||
dataxMongoDBPojo.setUpsertKey(mongoDBWriterDto.getUpsertKey());
|
||||
|
||||
dataxMongoDBPojo.setUpsertInfo(mongoDBWriterDto.getUpsertInfo());
|
||||
return writerPlugin.buildMongoDB(dataxMongoDBPojo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.wugui.datax.admin.tool.datax.writer;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.wugui.datax.admin.dto.UpsertInfo;
|
||||
import com.wugui.datax.admin.tool.pojo.DataxMongoDBPojo;
|
||||
|
||||
import java.util.Map;
|
||||
@ -17,7 +18,6 @@ public class MongoDBWriter extends BaseWriterPlugin implements DataxWriterInterf
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> buildMongoDB(DataxMongoDBPojo plugin) {
|
||||
//构建
|
||||
@ -29,12 +29,11 @@ public class MongoDBWriter extends BaseWriterPlugin implements DataxWriterInterf
|
||||
parameterObj.put("userPassword", plugin.getJdbcDatasource().getJdbcPassword());
|
||||
parameterObj.put("dbName", plugin.getDbName());
|
||||
parameterObj.put("collectionName", plugin.getCollectionName());
|
||||
UpsertInfo upsert = plugin.getUpsertInfo();
|
||||
if (upsert != null) {
|
||||
parameterObj.put("upsertInfo", upsert);
|
||||
}
|
||||
writerObj.put("parameter", parameterObj);
|
||||
|
||||
Map<String, Object> upsertInfo = Maps.newLinkedHashMap();
|
||||
upsertInfo.put("isUpsert", plugin.isUpsert());
|
||||
parameterObj.put("upsertKey", plugin.getUpsertKey());
|
||||
writerObj.put("upsertInfo", upsertInfo);
|
||||
return writerObj;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.wugui.datax.admin.tool.pojo;
|
||||
|
||||
import com.wugui.datax.admin.dto.UpsertInfo;
|
||||
import com.wugui.datax.admin.entity.JobDatasource;
|
||||
import lombok.Data;
|
||||
|
||||
@ -20,7 +21,7 @@ public class DataxMongoDBPojo {
|
||||
/**
|
||||
* hive列名
|
||||
*/
|
||||
private List<Map<String,Object>> columns;
|
||||
private List<Map<String, Object>> columns;
|
||||
|
||||
/**
|
||||
* 数据源信息
|
||||
@ -33,13 +34,6 @@ public class DataxMongoDBPojo {
|
||||
|
||||
private String collectionName;
|
||||
|
||||
/**
|
||||
* 当设置为true时,表示针对相同的upsertKey做更新操作
|
||||
*/
|
||||
private boolean isUpsert;
|
||||
/**
|
||||
* upsertKey指定了没行记录的业务主键。用来做更新时使用。
|
||||
*/
|
||||
private String upsertKey;
|
||||
}
|
||||
private UpsertInfo upsertInfo;
|
||||
|
||||
}
|
||||
12
datax-all.iml
Normal file
12
datax-all.iml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
Loading…
Reference in New Issue
Block a user