-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
772 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>cn.abel</groupId> | ||
<artifactId>springboot-neo4j</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.0.4.RELEASE</version> | ||
<relativePath/> | ||
</parent> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-freemarker</artifactId> | ||
</dependency> | ||
|
||
<!--mybatis--> | ||
<dependency> | ||
<groupId>org.mybatis.spring.boot</groupId> | ||
<artifactId>mybatis-spring-boot-starter</artifactId> | ||
<version>1.3.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.pagehelper</groupId> | ||
<artifactId>pagehelper-spring-boot-starter</artifactId> | ||
<version>1.2.5</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>mysql</groupId> | ||
<artifactId>mysql-connector-java</artifactId> | ||
<version>5.1.40</version> | ||
</dependency> | ||
|
||
|
||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<version>3.4</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.alibaba</groupId> | ||
<artifactId>fastjson</artifactId> | ||
<version>1.2.40</version> | ||
</dependency> | ||
|
||
<!--neo4j--> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-data-neo4j</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.neo4j</groupId> | ||
<artifactId>neo4j-ogm-http-driver</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
17 changes: 17 additions & 0 deletions
17
springboot-neo4j/src/main/java/cn/abel/neo4j/Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package cn.abel.neo4j; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; | ||
|
||
/** | ||
* @author yyb | ||
* @time 2019/3/26 | ||
*/ | ||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) | ||
public class Application { | ||
public static void main(String[] args) { | ||
SpringApplication.run(Application.class, args); | ||
} | ||
|
||
} |
141 changes: 141 additions & 0 deletions
141
springboot-neo4j/src/main/java/cn/abel/neo4j/bean/King.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
package cn.abel.neo4j.bean; | ||
|
||
|
||
import cn.abel.neo4j.bean.relation.FatherAndSonRelation; | ||
import org.neo4j.ogm.annotation.NodeEntity; | ||
import org.neo4j.ogm.annotation.Relationship; | ||
|
||
import java.io.Serializable; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* 皇帝 | ||
* | ||
* @author yyb | ||
* @time 2020/3/23 | ||
*/ | ||
@NodeEntity(label = "King") | ||
public class King extends Person implements Serializable { | ||
|
||
/** | ||
* 名字 | ||
*/ | ||
private String name; | ||
/** | ||
* 家系:家族关系 | ||
*/ | ||
private String clan; | ||
/** | ||
* 年号:生活的时代 | ||
*/ | ||
private String times; | ||
/** | ||
* 谥号:人死之后,后人给予评价 | ||
*/ | ||
private String posthumousTitle; | ||
/** | ||
* 庙号:君主于庙中被供奉时所称呼的名号 | ||
*/ | ||
private String TempleNumber; | ||
/** | ||
* 陵墓 | ||
*/ | ||
private String tomb; | ||
/** | ||
* 大事件 | ||
*/ | ||
private String remark; | ||
|
||
@Relationship(type = "传位") | ||
King successor; | ||
|
||
/** | ||
* 第二种保存关系的方式 | ||
*/ | ||
@Relationship | ||
List<FatherAndSonRelation> sons; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getClan() { | ||
return clan; | ||
} | ||
|
||
public void setClan(String clan) { | ||
this.clan = clan; | ||
} | ||
|
||
public String getTimes() { | ||
return times; | ||
} | ||
|
||
public void setTimes(String times) { | ||
this.times = times; | ||
} | ||
|
||
public String getPosthumousTitle() { | ||
return posthumousTitle; | ||
} | ||
|
||
public void setPosthumousTitle(String posthumousTitle) { | ||
this.posthumousTitle = posthumousTitle; | ||
} | ||
|
||
public String getTempleNumber() { | ||
return TempleNumber; | ||
} | ||
|
||
public void setTempleNumber(String templeNumber) { | ||
TempleNumber = templeNumber; | ||
} | ||
|
||
public String getTomb() { | ||
return tomb; | ||
} | ||
|
||
public void setTomb(String tomb) { | ||
this.tomb = tomb; | ||
} | ||
|
||
public String getRemark() { | ||
return remark; | ||
} | ||
|
||
public void setRemark(String remark) { | ||
this.remark = remark; | ||
} | ||
|
||
public King getSuccessor() { | ||
return successor; | ||
} | ||
|
||
public void setSuccessor(King successor) { | ||
this.successor = successor; | ||
} | ||
|
||
public List<FatherAndSonRelation> getSons() { | ||
return sons; | ||
} | ||
|
||
public void setSons(List<FatherAndSonRelation> sons) { | ||
this.sons = sons; | ||
} | ||
|
||
/** | ||
* 添加友谊的关系 | ||
* @param | ||
*/ | ||
public void addRelation(FatherAndSonRelation fatherAndSonRelation){ | ||
if(this.sons == null){ | ||
this.sons = new ArrayList<>(); | ||
} | ||
this.sons.add(fatherAndSonRelation); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
springboot-neo4j/src/main/java/cn/abel/neo4j/bean/Person.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package cn.abel.neo4j.bean; | ||
|
||
import org.neo4j.ogm.annotation.GeneratedValue; | ||
import org.neo4j.ogm.annotation.Id; | ||
import org.neo4j.ogm.annotation.Index; | ||
|
||
/** | ||
* @author yyb | ||
* @time 2020/3/23 | ||
*/ | ||
public class Person { | ||
|
||
@Id | ||
// @GeneratedValue 该注解应去除否则插入不成功 | ||
@Index | ||
private long id; | ||
|
||
public long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(long id) { | ||
this.id = id; | ||
} | ||
} |
111 changes: 111 additions & 0 deletions
111
springboot-neo4j/src/main/java/cn/abel/neo4j/bean/Queen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
package cn.abel.neo4j.bean; | ||
|
||
import org.neo4j.ogm.annotation.Relationship; | ||
|
||
/** | ||
* 皇后 | ||
* | ||
* @author yyb | ||
* @time 2020/3/23 | ||
*/ | ||
public class Queen extends Person { | ||
/** | ||
* 名字 | ||
*/ | ||
private String name; | ||
/** | ||
* 家系:家族关系 | ||
*/ | ||
private String clan; | ||
/** | ||
* 年号:生活的时代 | ||
*/ | ||
private String times; | ||
/** | ||
* 庙号:君主于庙中被供奉时所称呼的名号 | ||
*/ | ||
private String TempleNumber; | ||
/** | ||
* 谥号:人死之后,后人给予评价 | ||
*/ | ||
private String posthumousTitle; | ||
/** | ||
* 陵墓 | ||
*/ | ||
private String son; | ||
/** | ||
* 备注 | ||
*/ | ||
private String remark; | ||
|
||
/** | ||
* 关系指向自己 | ||
*/ | ||
@Relationship(type = "皇后", direction = Relationship.INCOMING) | ||
private King king; | ||
|
||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getClan() { | ||
return clan; | ||
} | ||
|
||
public void setClan(String clan) { | ||
this.clan = clan; | ||
} | ||
|
||
public String getTimes() { | ||
return times; | ||
} | ||
|
||
public void setTimes(String times) { | ||
this.times = times; | ||
} | ||
|
||
public String getTempleNumber() { | ||
return TempleNumber; | ||
} | ||
|
||
public void setTempleNumber(String templeNumber) { | ||
TempleNumber = templeNumber; | ||
} | ||
|
||
public String getPosthumousTitle() { | ||
return posthumousTitle; | ||
} | ||
|
||
public void setPosthumousTitle(String posthumousTitle) { | ||
this.posthumousTitle = posthumousTitle; | ||
} | ||
|
||
public String getSon() { | ||
return son; | ||
} | ||
|
||
public void setSon(String son) { | ||
this.son = son; | ||
} | ||
|
||
public String getRemark() { | ||
return remark; | ||
} | ||
|
||
public void setRemark(String remark) { | ||
this.remark = remark; | ||
} | ||
|
||
public King getKing() { | ||
return king; | ||
} | ||
|
||
public void setKing(King king) { | ||
this.king = king; | ||
} | ||
} |
Oops, something went wrong.