Commit 1c6cc46a by qiuchaofei

1.同步表与表,2.修改从mongo读数的方式,3修改dependency的存储方式。

parent b196d6db
...@@ -2,6 +2,28 @@ package com.keymobile.metadata.metadataRelation.pojo; ...@@ -2,6 +2,28 @@ package com.keymobile.metadata.metadataRelation.pojo;
import org.neo4j.ogm.annotation.RelationshipEntity; import org.neo4j.ogm.annotation.RelationshipEntity;
@RelationshipEntity(type = "Dependency") @RelationshipEntity(type = "流向")
public class DependencyRelation extends BaseRelationship { public class DependencyRelation extends BaseRelationship {
private String jobId;
public String getJobId() {
return jobId;
}
public void setJobId(String jobId) {
this.jobId = jobId;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
private String description;
} }
package com.keymobile.metadata.metadataRelation.respository;
import com.keymobile.metadata.metadataRelation.pojo.DependencyRelation;
import org.springframework.data.neo4j.repository.Neo4jRepository;
public interface DependencyRelationResposity extends Neo4jRepository<DependencyRelation, Long> {
}
...@@ -108,4 +108,6 @@ public interface IMetadataService { ...@@ -108,4 +108,6 @@ public interface IMetadataService {
void syschro1104Relations(String catalogName); void syschro1104Relations(String catalogName);
void syschroTable2TableRelations(String catalogName);
} }
...@@ -157,19 +157,34 @@ public class MongoDbServiceImpl { ...@@ -157,19 +157,34 @@ public class MongoDbServiceImpl {
return mongoTemplate.count(query, Document.class, PREFIX_MD_RELATION_TEMP_NODE + catalogName); return mongoTemplate.count(query, Document.class, PREFIX_MD_RELATION_TEMP_NODE + catalogName);
} }
public List<Document> findRelationByPage(Pageable pageable, String catalogName) { public List<Document> findRelationByPageInputOutPut(Pageable pageable, String catalogName) {
Query query = new Query(new Criteria().orOperator(Criteria.where("type").is(INPUT),Criteria.where("type").is(OUTPUT))); Query query = new Query(new Criteria().orOperator(Criteria.where("type").is(INPUT),Criteria.where("type").is(OUTPUT)));
query.with(pageable); query.with(pageable);
return mongoTemplate.find(query, Document.class, PREFIX_MD_RELATION + catalogName); return mongoTemplate.find(query, Document.class, PREFIX_MD_RELATION + catalogName);
} }
public long countRelation(Pageable pageable, String catalogName) { public long countRelationByInputOutPut(Pageable pageable, String catalogName) {
Query query = new Query(new Criteria().orOperator(Criteria.where("type").is(INPUT),Criteria.where("type").is(OUTPUT))); Query query = new Query(new Criteria().orOperator(Criteria.where("type").is(INPUT),Criteria.where("type").is(OUTPUT)));
query.with(pageable); query.with(pageable);
return mongoTemplate.count(query, Document.class, PREFIX_MD_RELATION + catalogName); return mongoTemplate.count(query, Document.class, PREFIX_MD_RELATION + catalogName);
} }
public List<Document> findRelationByDependency(Pageable pageable, String catalogName) {
Query query = new Query(new Criteria().andOperator(Criteria.where("type").is("Dependency"),Criteria.where("from").is("Script")));
query.with(pageable);
return mongoTemplate.find(query, Document.class, PREFIX_MD_RELATION + catalogName);
}
public long countRelationByDependency(Pageable pageable, String catalogName) {
Query query = new Query(new Criteria().andOperator(Criteria.where("type").is("Dependency"),Criteria.where("from").is("Script")));
// Query query = new Query(new Criteria().orOperator(Criteria.where("type").is(INPUT),Criteria.where("type").is(OUTPUT)));
query.with(pageable);
return mongoTemplate.count(query, Document.class, PREFIX_MD_RELATION + catalogName);
}
public long countRelationByJobId(Pageable pageable, String catalogName,String jobId) { public long countRelationByJobId(Pageable pageable, String catalogName,String jobId) {
Query query = new Query(new Criteria() .andOperator(Criteria.where("jobId").is(jobId), Query query = new Query(new Criteria() .andOperator(Criteria.where("jobId").is(jobId),
new Criteria().orOperator(Criteria.where("type").is(INPUT),Criteria.where("type").is(OUTPUT)) new Criteria().orOperator(Criteria.where("type").is(INPUT),Criteria.where("type").is(OUTPUT))
...@@ -194,4 +209,37 @@ public class MongoDbServiceImpl { ...@@ -194,4 +209,37 @@ public class MongoDbServiceImpl {
return mongoTemplate.findAll(Document.class, "Relation" + catalogName); return mongoTemplate.findAll(Document.class, "Relation" + catalogName);
} }
//按照字段id模糊匹配,查总数
public long countColumnByColumnId(Pageable pageable, String catalogName,String columnModelPath) {
Query query = new Query(Criteria.where("_class").is(columnModelPath));
query.with(pageable);
return mongoTemplate.count(query, Document.class, PREFIX_METADATA_NODE + catalogName);
}
public List<Document> findColumnByColumnIdByPage(Pageable pageable, String catalogName,String columnModelPath) {
Query query = new Query(Criteria.where("_class").is(columnModelPath));
query.with(pageable);
return mongoTemplate.find(query, Document.class, PREFIX_METADATA_NODE + catalogName);
}
/**
BasicDBObject query = new BasicDBObject();
query.put(T_L, null);
FindIterable<Document> iterables = this.mongoTemplate.getCollection(name).find(query);
MongoCursor<Document> cursor = iterables.iterator();
List<Document> results = new ArrayList<>();
int i = 1;
while (cursor.hasNext()) {
results.add(cursor.next());
if (i % 30000 == 0) {
processList(results, name);
LogManager.logInfo(InitCtrl.class, name + "已处理了" + i + "条");
}
i++;
}
*/
} }
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