Skip to content

Commit

Permalink
添加图数据库
Browse files Browse the repository at this point in the history
  • Loading branch information
527515025 committed Mar 24, 2020
1 parent f1886c8 commit 934dfa3
Show file tree
Hide file tree
Showing 16 changed files with 772 additions and 0 deletions.
2 changes: 2 additions & 0 deletions abel-util/src/main/java/cn/abel/code/InfoCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public enum InfoCode {
ACCOUNT_SEARCH_FAIL(20037, "账号查询失败"),
LOGIN_NAME_TYPE_ERROR(20038, "登录名不为空时,登录方式不能为空"),
PASSWORD_SIMPLE_ERROR(20042, "密码错误,长度应为6-18,包含字母、数字和特殊字符"),
PASSWORD_ERROR_MORE_THAN(20043,"用户名密码连续错误已达5次,请15分钟后再试"),
LOGIN_TYPE_ERROR(20044, "不支持的登录类型"),
SERVICE_UNAVAILABLE(50000, "操作失败,请重试");

private int status;
Expand Down
Binary file added springboot-neo4j/doc/效果图.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 83 additions & 0 deletions springboot-neo4j/pom.xml
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 springboot-neo4j/src/main/java/cn/abel/neo4j/Application.java
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 springboot-neo4j/src/main/java/cn/abel/neo4j/bean/King.java
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 springboot-neo4j/src/main/java/cn/abel/neo4j/bean/Person.java
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 springboot-neo4j/src/main/java/cn/abel/neo4j/bean/Queen.java
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;
}
}
Loading

0 comments on commit 934dfa3

Please sign in to comment.