Commit bb564174 by mahx

添加作业前后关系

parent 2fd8c237
package com.keymobile.metadata.metadataRelation.pojo;
import org.neo4j.ogm.annotation.RelationshipEntity;
/**
* @author mahx
* @version 1.0
* @date 2021/11/12 17:53
*/
@RelationshipEntity(type = "Post")
public class PostRelation extends BaseRelationship {
}
package com.keymobile.metadata.metadataRelation.pojo;
import org.neo4j.ogm.annotation.RelationshipEntity;
/**
* @author mahx
* @version 1.0
* @date 2021/11/12 17:53
*/
@RelationshipEntity(type = "Pre")
public class PreRelation extends BaseRelationship {
}
package com.keymobile.metadata.metadataRelation.respository;
import com.keymobile.metadata.metadataRelation.pojo.PostRelation;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;
/**
* @author mahx
* @version 1.0
* @date 2021/11/12 17:55
*/
public interface PostRelationRepository extends Neo4jRepository<PostRelation, Long> {
@Query("match (source:BaseNode),(target:BaseNode) where source.metadataId=$sourceId and target.metadataId=$targetId create p=(source)-[r:Post]->(target) return p")
PostRelation mergePostRelation(@Param("sourceId") String sourceId, @Param("targetId") String targetId);
}
package com.keymobile.metadata.metadataRelation.respository;
import com.keymobile.metadata.metadataRelation.pojo.PreRelation;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;
/**
* @author mahx
* @version 1.0
* @date 2021/11/12 17:54
*/
public interface PreRelationRepository extends Neo4jRepository<PreRelation, Long> {
@Query("match (source:BaseNode),(target:BaseNode) where source.metadataId=$sourceId and target.metadataId=$targetId create p=(source)-[r:Pre]->(target) return p")
PreRelation mergePreRelation(@Param("sourceId") String sourceId, @Param("targetId") String targetId);
}
......@@ -47,6 +47,12 @@ public class MetadataServiceImpl implements IMetadataService {
private TempNodeRepository tempNodeRepository;
@Autowired
private PreRelationRepository preRelationRepository;
@Autowired
private PostRelationRepository postRelationRepository;
@Autowired
private MongoDbServiceImpl mongoDbServiceImpl;
@Autowired
......@@ -316,6 +322,10 @@ public class MetadataServiceImpl implements IMetadataService {
if(relationship == null || relationship.size()==0){
executeRelationRepository.addExecuteRelation(sourceId,targetId);
}
} else if ("post".equalsIgnoreCase(type)) {
postRelationRepository.mergePostRelation(sourceId, targetId);
} else if ("pre".equalsIgnoreCase(type)) {
preRelationRepository.mergePreRelation(sourceId, targetId);
}
}
......
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