提交 e59d3a7d 编写于 作者: tangyaolong's avatar tangyaolong

添加数据集

上级 3a7c2ece
...@@ -21,6 +21,7 @@ public class AssembleModel { ...@@ -21,6 +21,7 @@ public class AssembleModel {
private List<DAMetric> metrics; private List<DAMetric> metrics;
private LinkedHashSet<MetaDataSet> metaDataSets; private LinkedHashSet<MetaDataSet> metaDataSets;
private LinkedHashSet<DstDataSource> dataSources;
private LinkedHashSet<MetaRelationship> references; private LinkedHashSet<MetaRelationship> references;
private LinkedHashSet<MetaRelationship> nesteds; private LinkedHashSet<MetaRelationship> nesteds;
private LinkedHashSet<MetaField> metaFields; private LinkedHashSet<MetaField> metaFields;
......
...@@ -72,6 +72,10 @@ public class MetaModelExService extends MetaModelServiceImpl { ...@@ -72,6 +72,10 @@ public class MetaModelExService extends MetaModelServiceImpl {
@Lazy @Lazy
private IMetaEntityService metaEntityService; private IMetaEntityService metaEntityService;
@Resource
@Lazy
private IDstDataSourceService dstDataSourceService;
@Autowired @Autowired
@Lazy @Lazy
private IMetaDataSetService dataSetService; private IMetaDataSetService dataSetService;
...@@ -161,6 +165,13 @@ public class MetaModelExService extends MetaModelServiceImpl { ...@@ -161,6 +165,13 @@ public class MetaModelExService extends MetaModelServiceImpl {
entities.add(item.getEntity()); entities.add(item.getEntity());
}); });
if(entities.size()>0){ if(entities.size()>0){
LinkedHashSet<DstDataSource> dataSource = new LinkedHashSet();
for (MetaEntity entity : entities) {
if(!ObjectUtils.isEmpty(entity.getDataSource())){
dataSource.add(entity.getDataSource());
}
}
dstDataSourceService.saveBatch(dataSource);
metaEntityService.saveBatch(entities); metaEntityService.saveBatch(entities);
} }
if(p_relations.size()>0){ if(p_relations.size()>0){
...@@ -232,6 +243,7 @@ public class MetaModelExService extends MetaModelServiceImpl { ...@@ -232,6 +243,7 @@ public class MetaModelExService extends MetaModelServiceImpl {
String modelId = et.getId(); String modelId = et.getId();
AssembleModel models = new AssembleModel(); AssembleModel models = new AssembleModel();
List<DAMetric> metrics = new ArrayList<>(); List<DAMetric> metrics = new ArrayList<>();
LinkedHashSet<DstDataSource> dataSources = new LinkedHashSet();
LinkedHashSet<String> entities = new LinkedHashSet<>(); LinkedHashSet<String> entities = new LinkedHashSet<>();
// 查询模型 // 查询模型
MetaModel metaModel = metaModelService.get(et.getId()); MetaModel metaModel = metaModelService.get(et.getId());
...@@ -274,7 +286,14 @@ public class MetaModelExService extends MetaModelServiceImpl { ...@@ -274,7 +286,14 @@ public class MetaModelExService extends MetaModelServiceImpl {
} }
} }
// 将关联的数据集,上下级关系,字段一并存入 // 将关联的数据集,上下级关系,字段一并存入
models.setEntityModels(getEntityModel(modelId)); List<EntityModel> entityModels = getEntityModel(modelId);
for (EntityModel entityModel:entityModels) {
if(!ObjectUtils.isEmpty(entityModel.getEntity().getDataSource())){
dataSources.add(entityModel.getEntity().getDataSource());
}
}
models.setDataSources(dataSources);
models.setEntityModels(entityModels);
models.setMetaModel(metaModel); models.setMetaModel(metaModel);
models.setRuleItems(metaModel.getRuleitems()); models.setRuleItems(metaModel.getRuleitems());
models.setDaBuilds(metaModel.getBuilds()); models.setDaBuilds(metaModel.getBuilds());
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册