此项目为spring boot - myBatis - neo4j数据库整合项目。
有增删改查(节点关系)、动态分页条件排序等一些示例。
git下载地址:git clone https://github.com/wsm1217395196/my-project-demo.git 项目名:springboot-mybatis-neo4j
运行此项目前请先到http://localhost:7474/browser/运行cql(确定安装了neo4j数据库)
create (u:user{name:'wsm',sex:'男',age:23}) - [l:like] -> (y:user{name:'yy',sex:'女',age:21})

pom文件依赖

<?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>
<span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>springboot-neo4j-mybatis<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>springboot-neo4j-mybatis<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>1.0-SNAPSHOT<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span> <span class="hljs-tag">&lt;<span class="hljs-name">dependencies</span>&gt;</span>
<span class="hljs-comment">&lt;!--spring boot--&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.springframework.boot<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>spring-boot-starter-web<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>2.1.2.RELEASE<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.springframework.boot<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>spring-boot-starter-test<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">scope</span>&gt;</span>test<span class="hljs-tag">&lt;/<span class="hljs-name">scope</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>2.1.2.RELEASE<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span> <span class="hljs-comment">&lt;!--org.json--&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.json<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>json<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>20180813<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span> <span class="hljs-comment">&lt;!--neo4j-jdbc-driver--&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.neo4j<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>neo4j-jdbc-driver<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>3.4.0<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span> <span class="hljs-comment">&lt;!--mybatis-spring-boot--&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.mybatis.spring.boot<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>mybatis-spring-boot-starter<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>2.0.1<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">dependencies</span>&gt;</span> <span class="hljs-tag">&lt;<span class="hljs-name">build</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">plugins</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">plugin</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.springframework.boot<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>spring-boot-maven-plugin<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">plugin</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">plugins</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">build</span>&gt;</span>

</project>

application.yml

#端口号
server:
port: 8018 spring:

application:

name: springboot-mybatis-neo4j #服务名 datasource:

driver-class-name: org.neo4j.jdbc.http.HttpDriver

name: neo4j

password: root

url: jdbc:neo4j:http://localhost:7474 mybatis:

mapper-locations: classpath:mapper/*.xml

UserMapper.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org/DTD Mapper 3.0" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.study.mapper.UserMapper">
<span class="hljs-comment">&lt;!-- 自定义结果集--&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">resultMap</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"userMap"</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"com.study.model.UserModel"</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">id</span> <span class="hljs-attr">property</span>=<span class="hljs-string">"id"</span> <span class="hljs-attr">column</span>=<span class="hljs-string">"id"</span>/&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">result</span> <span class="hljs-attr">property</span>=<span class="hljs-string">"name"</span> <span class="hljs-attr">column</span>=<span class="hljs-string">"name"</span>/&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">result</span> <span class="hljs-attr">property</span>=<span class="hljs-string">"age"</span> <span class="hljs-attr">column</span>=<span class="hljs-string">"age"</span>/&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">result</span> <span class="hljs-attr">property</span>=<span class="hljs-string">"sex"</span> <span class="hljs-attr">column</span>=<span class="hljs-string">"sex"</span>/&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">collection</span> <span class="hljs-attr">property</span>=<span class="hljs-string">"userModels"</span> <span class="hljs-attr">ofType</span>=<span class="hljs-string">"com.study.model.UserModel"</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">id</span> <span class="hljs-attr">property</span>=<span class="hljs-string">"id"</span> <span class="hljs-attr">column</span>=<span class="hljs-string">"id1"</span>/&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">result</span> <span class="hljs-attr">property</span>=<span class="hljs-string">"name"</span> <span class="hljs-attr">column</span>=<span class="hljs-string">"name1"</span>/&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">result</span> <span class="hljs-attr">property</span>=<span class="hljs-string">"age"</span> <span class="hljs-attr">column</span>=<span class="hljs-string">"age1"</span>/&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">result</span> <span class="hljs-attr">property</span>=<span class="hljs-string">"sex"</span> <span class="hljs-attr">column</span>=<span class="hljs-string">"sex1"</span>/&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">collection</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">resultMap</span>&gt;</span> <span class="hljs-comment">&lt;!--这里CQL语句返回的字段名必须与上面定义的结果集的字段名一致,若不一致需要重命名,否则会报空指针异常 --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">select</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"getPage"</span> <span class="hljs-attr">resultMap</span>=<span class="hljs-string">"userMap"</span>&gt;</span>
match (u:user)
<span class="hljs-tag">&lt;<span class="hljs-name">where</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">if</span> <span class="hljs-attr">test</span>=<span class="hljs-string">"name != null and name != ''"</span>&gt;</span>
u.name =~ #{name}
<span class="hljs-tag">&lt;/<span class="hljs-name">if</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">if</span> <span class="hljs-attr">test</span>=<span class="hljs-string">"sex != null and sex != ''"</span>&gt;</span>
and u.sex = #{sex}
<span class="hljs-tag">&lt;/<span class="hljs-name">if</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">where</span>&gt;</span>
return
id(u) as id,u.name as name,u.age as age,u.sex as sex
<span class="hljs-tag">&lt;<span class="hljs-name">if</span> <span class="hljs-attr">test</span>=<span class="hljs-string">"sort != null and sort != ''"</span>&gt;</span>
order by ${sort}
<span class="hljs-tag">&lt;/<span class="hljs-name">if</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">if</span> <span class="hljs-attr">test</span>=<span class="hljs-string">"pageStart &gt;= 0 and pageSize &gt; 0"</span>&gt;</span>
skip #{pageStart} limit #{pageSize}
<span class="hljs-tag">&lt;/<span class="hljs-name">if</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">select</span>&gt;</span> <span class="hljs-tag">&lt;<span class="hljs-name">select</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"getPageTotal"</span> <span class="hljs-attr">resultType</span>=<span class="hljs-string">"int"</span>&gt;</span>
match (u:user)
<span class="hljs-tag">&lt;<span class="hljs-name">where</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">if</span> <span class="hljs-attr">test</span>=<span class="hljs-string">"name != null and name != ''"</span>&gt;</span>
u.name =~ #{name}
<span class="hljs-tag">&lt;/<span class="hljs-name">if</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">if</span> <span class="hljs-attr">test</span>=<span class="hljs-string">"sex != null and sex != ''"</span>&gt;</span>
and u.sex = #{sex}
<span class="hljs-tag">&lt;/<span class="hljs-name">if</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">where</span>&gt;</span>
return count(*)
<span class="hljs-tag">&lt;/<span class="hljs-name">select</span>&gt;</span> <span class="hljs-tag">&lt;<span class="hljs-name">select</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"getAll"</span> <span class="hljs-attr">resultMap</span>=<span class="hljs-string">"userMap"</span>&gt;</span>
match
(u:user)
return
id(u) as id,u.name as name,u.age as age,u.sex as sex
<span class="hljs-tag">&lt;/<span class="hljs-name">select</span>&gt;</span> <span class="hljs-tag">&lt;<span class="hljs-name">select</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"getById"</span> <span class="hljs-attr">resultMap</span>=<span class="hljs-string">"userMap"</span>&gt;</span>
match
(u:user)- [l:like] -&gt; (u1:user)
where
id(u) = #{id}
return
id(u) as id,u.name as name,u.age as age,u.sex as sex,
id(u1) as id1,u1.name as name1,u1.age as age1,u1.sex as sex1
<span class="hljs-tag">&lt;/<span class="hljs-name">select</span>&gt;</span> <span class="hljs-tag">&lt;<span class="hljs-name">insert</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"add"</span>&gt;</span>
create(u:user{name:#{model.name},age:#{model.age},sex:#{model.sex}})
<span class="hljs-tag">&lt;/<span class="hljs-name">insert</span>&gt;</span> <span class="hljs-tag">&lt;<span class="hljs-name">update</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"update"</span>&gt;</span>
match (u:user)
where id(u) = #{model.id}
set u.name = #{model.name},u.age = #{model.age},u.sex = #{model.sex}
<span class="hljs-tag">&lt;/<span class="hljs-name">update</span>&gt;</span> <span class="hljs-tag">&lt;<span class="hljs-name">delete</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"deleteById"</span>&gt;</span>
match (u:user) where id(u) = #{id} delete u
<span class="hljs-tag">&lt;/<span class="hljs-name">delete</span>&gt;</span>

</mapper>

UserMapper接口

package com.study.mapper;

import com.study.model.UserModel;

import org.apache.ibatis.annotations.Param; import java.util.List; public interface UserMapper {
<span class="hljs-built_in">List</span>&lt;UserModel&gt; getPage(<span class="hljs-meta">@Param</span>(<span class="hljs-string">"pageStart"</span>) <span class="hljs-built_in">int</span> pageStart, <span class="hljs-meta">@Param</span>(<span class="hljs-string">"pageSize"</span>) <span class="hljs-built_in">int</span> pageSize, <span class="hljs-meta">@Param</span>(<span class="hljs-string">"sort"</span>) <span class="hljs-built_in">String</span> sort, <span class="hljs-meta">@Param</span>(<span class="hljs-string">"name"</span>) <span class="hljs-built_in">String</span> name, <span class="hljs-meta">@Param</span>(<span class="hljs-string">"sex"</span>) <span class="hljs-built_in">String</span> sex);

<span class="hljs-built_in">int</span> getPageTotal(<span class="hljs-meta">@Param</span>(<span class="hljs-string">"name"</span>) <span class="hljs-built_in">String</span> name, <span class="hljs-meta">@Param</span>(<span class="hljs-string">"sex"</span>) <span class="hljs-built_in">String</span> sex);

<span class="hljs-built_in">List</span>&lt;UserModel&gt; getAll();

UserModel getById(<span class="hljs-meta">@Param</span>(<span class="hljs-string">"id"</span>) Long id);

<span class="hljs-built_in">int</span> add(<span class="hljs-meta">@Param</span>(<span class="hljs-string">"model"</span>) UserModel model);

<span class="hljs-built_in">int</span> update(<span class="hljs-meta">@Param</span>(<span class="hljs-string">"model"</span>) UserModel model);

<span class="hljs-built_in">int</span> deleteById(<span class="hljs-meta">@Param</span>(<span class="hljs-string">"id"</span>) Long id);

}

userModel实体类

package com.study.model;

import java.util.List;

public class UserModel {
<span class="hljs-keyword">private</span> Long id;

<span class="hljs-keyword">private</span> String name;

<span class="hljs-keyword">private</span> Integer age;

<span class="hljs-keyword">private</span> String sex;

<span class="hljs-keyword">private</span> List&lt;UserModel&gt; userModels;

<span class="hljs-function"><span class="hljs-keyword">public</span> Long <span class="hljs-title">getId</span><span class="hljs-params">()</span> </span>{
<span class="hljs-keyword">return</span> id;
} <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">setId</span><span class="hljs-params">(Long id)</span> </span>{
<span class="hljs-keyword">this</span>.id = id;
} <span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">getName</span><span class="hljs-params">()</span> </span>{
<span class="hljs-keyword">return</span> name;
} <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">setName</span><span class="hljs-params">(String name)</span> </span>{
<span class="hljs-keyword">this</span>.name = name;
} <span class="hljs-function"><span class="hljs-keyword">public</span> Integer <span class="hljs-title">getAge</span><span class="hljs-params">()</span> </span>{
<span class="hljs-keyword">return</span> age;
} <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">setAge</span><span class="hljs-params">(Integer age)</span> </span>{
<span class="hljs-keyword">this</span>.age = age;
} <span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">getSex</span><span class="hljs-params">()</span> </span>{
<span class="hljs-keyword">return</span> sex;
} <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">setSex</span><span class="hljs-params">(String sex)</span> </span>{
<span class="hljs-keyword">this</span>.sex = sex;
} <span class="hljs-function"><span class="hljs-keyword">public</span> List&lt;UserModel&gt; <span class="hljs-title">getUserModels</span><span class="hljs-params">()</span> </span>{
<span class="hljs-keyword">return</span> userModels;
} <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">setUserModels</span><span class="hljs-params">(List&lt;UserModel&gt; userModels)</span> </span>{
<span class="hljs-keyword">this</span>.userModels = userModels;
}

}

UserController控制器

package com.study.controller;

import com.study.mapper.UserMapper;

import com.study.model.UserModel;

import com.study.result.PageParam;

import com.study.result.PageResult;

import org.json.JSONObject;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*; import java.util.List; @RestController

@RequestMapping("/user")

public class UserController {
<span class="hljs-meta">@Autowired</span>
<span class="hljs-keyword">private</span> UserMapper userMapper; <span class="hljs-comment">/**
* 分页条件查询
* 参数例:{"pageIndex":1,"pageSize":2,"sort":"u.sex desc","condition":"{'name':'','sex':'男'}"}
*
* <span class="hljs-doctag">@param</span> pageParam
* <span class="hljs-doctag">@return</span>
*/</span>
<span class="hljs-meta">@PostMapping</span>(<span class="hljs-string">"/getPage"</span>)
<span class="hljs-function"><span class="hljs-keyword">public</span> PageResult <span class="hljs-title">getPage</span><span class="hljs-params">(@RequestBody PageParam pageParam)</span> </span>{
<span class="hljs-keyword">int</span> pageStart = pageParam.getPageStart();
<span class="hljs-keyword">int</span> pageIndex = pageParam.getPageIndex();
<span class="hljs-keyword">int</span> pageSize = pageParam.getPageSize();
String sort = pageParam.getSort(); JSONObject jsonObject = <span class="hljs-keyword">new</span> JSONObject(pageParam.getCondition());
String name = <span class="hljs-string">".*"</span> + jsonObject.getString(<span class="hljs-string">"name"</span>) + <span class="hljs-string">".*"</span>; <span class="hljs-comment">//模糊查询</span>
String sex = jsonObject.getString(<span class="hljs-string">"sex"</span>); List&lt;UserModel&gt; models = userMapper.getPage(pageStart, pageSize, sort, name, sex);
<span class="hljs-keyword">int</span> total = userMapper.getPageTotal(name, sex);
PageResult pageResult = <span class="hljs-keyword">new</span> PageResult(pageIndex, pageSize, total, models); <span class="hljs-keyword">return</span> pageResult;
} <span class="hljs-meta">@GetMapping</span>(<span class="hljs-string">"/getAll"</span>)
<span class="hljs-function"><span class="hljs-keyword">public</span> List&lt;UserModel&gt; <span class="hljs-title">getAll</span><span class="hljs-params">()</span> </span>{
List&lt;UserModel&gt; models = userMapper.getAll();
<span class="hljs-keyword">return</span> models;
} <span class="hljs-comment">/**
* 根据id查询(含节点关系)
*
* <span class="hljs-doctag">@param</span> id
* <span class="hljs-doctag">@return</span>
*/</span>
<span class="hljs-meta">@GetMapping</span>(<span class="hljs-string">"/getById/{id}"</span>)
<span class="hljs-function"><span class="hljs-keyword">public</span> UserModel <span class="hljs-title">getById</span><span class="hljs-params">(@PathVariable Long id)</span> </span>{
UserModel model = userMapper.getById(id);
<span class="hljs-keyword">return</span> model;
} <span class="hljs-meta">@PostMapping</span>(<span class="hljs-string">"/add"</span>)
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">int</span> <span class="hljs-title">add</span><span class="hljs-params">(@RequestBody UserModel model)</span> </span>{
<span class="hljs-keyword">int</span> i = userMapper.add(model);
<span class="hljs-keyword">return</span> i;
} <span class="hljs-meta">@PostMapping</span>(<span class="hljs-string">"/update"</span>)
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">int</span> <span class="hljs-title">update</span><span class="hljs-params">(@RequestBody UserModel model)</span> </span>{
<span class="hljs-keyword">int</span> i = userMapper.update(model);
<span class="hljs-keyword">return</span> i;
} <span class="hljs-meta">@DeleteMapping</span>(<span class="hljs-string">"/deleteById/{id}"</span>)
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">int</span> <span class="hljs-title">deleteById</span><span class="hljs-params">(@PathVariable Long id)</span> </span>{
<span class="hljs-keyword">int</span> i = userMapper.deleteById(id);
<span class="hljs-keyword">return</span> i;
}

}

要用分页条件查询请到git 上复制 PageResult,PageParam类。

最后在入口类记得加上扫描mapper接口@MapperScan(“com.study.mapper”)

      原文地址:https://blog.csdn.net/WSM960921/article/details/95076242                          </div>

SpingBoot myBatis neo4j整合项目案例的更多相关文章

  1. SSM(Spring,SpringMVC,Mybatis)框架整合项目

    快速上手SSM(Spring,SpringMVC,Mybatis)框架整合项目 环境要求: IDEA MySQL 8.0.25 Tomcat 9 Maven 3.6 数据库环境: 创建一个存放书籍数据 ...

  2. Spring3 + Spring MVC+ Mybatis 3+Mysql 项目整合(注解及源码)

    Spring3 + Spring MVC+ Mybatis 3+Mysql 项目整合(注解及源码) 备注: 之前在Spring3 + Spring MVC+ Mybatis 3+Mysql 项目整合中 ...

  3. Mybatis入门之MyBatis项目案例

    一.项目案例演示 后台管理系统用户数据维护平台 所有用户数据查询 单个用户数据查询 用户数据修改(完善资料) 锁定用户账号 删除用户账号 彻底删除用户账号 二.数据库数据准备工作 数据库:mysql ...

  4. Mybatis、maven项目中整合log4j (17)

    Mybatis.maven项目总整合log4j java 中Mybatis.maven项目总整合log4j 1.pom增加log4j包引用 2.添加 log4j.properties文件 # java ...

  5. Spring+SpringMVC+MyBatis+easyUI整合优化篇(二)Log4j讲解与整合

    日常啰嗦 上一篇文章主要讲述了一下syso和Log间的一些区别与比较,重点是在项目的日志功能上,因此,承接前文<Spring+SpringMVC+MyBatis+easyUI整合优化篇(一)Sy ...

  6. Spring+SpringMVC+MyBatis+easyUI整合优化篇(十三)数据层优化-表规范、索引优化

    本文提要 最近写的几篇文章都是关于数据层优化方面的,这几天也在想还有哪些地方可以优化改进,结合日志和项目代码发现,关于数据层的优化,还是有几个方面可以继续修改的,代码方面,整合了druid数据源也开启 ...

  7. Spring+SpringMVC+MyBatis+easyUI整合进阶篇(一)设计一套好的RESTful API

    写在前面的话 看了一下博客目录,距离上次更新这个系列的博文已经有两个多月,并不是因为不想继续写博客,由于中间这段时间更新了几篇其他系列的文章就暂时停止了,如今已经讲述的差不多,也就继续抽时间更新< ...

  8. Spring+SpringMVC+MyBatis+easyUI整合进阶篇(六)一定要RESTful吗?

    作者:13 GitHub:https://github.com/ZHENFENG13 版权声明:本文为原创文章,未经允许不得转载. 写在前面的话 这个问题看起来就显得有些萌,或者说类似的问题都有些不靠 ...

  9. Spring+SpringMVC+MyBatis+easyUI整合进阶篇(七)一次线上Mysql数据库崩溃事故的记录

    作者:13 GitHub:https://github.com/ZHENFENG13 版权声明:本文为原创文章,未经允许不得转载. 文章简介 工作这几年,技术栈在不断更新,项目管理心得也增加了不少,写 ...

随机推荐

  1. ssh连接Ubuntu之access denied

    解决方法是: 修改/etc/ssh/ssh_config文件, #PermitRootLogin prohibit-password改为PermitRootLogin yes 然后 PasswordA ...

  2. CAS去掉HTTPS认证

    如何去掉HTTPS认证? 说明:默认情况下HTTP也是可以访问CAS SERVER的,但认证,登陆,退出等操作均没有任何的效果.所以必须作出下面的修改 1.进入WEB-INF\spring-confi ...

  3. HBase Ganglia

  4. 新增的Java MapReduce API

    http://book.51cto.com/art/201106/269647.htm Hadoop的版本0.20.0包含有一个新的 Java MapReduce API,有时也称为"上下文 ...

  5. webpack 处理图片文件

    1. 安装 file-loader html-loader npm install file-loader html-loader --save-dev 其中html-loader生效需配合 html ...

  6. Java SE、Java EE、Java ME三者的区别

    1. Java SE(Java Platform,Standard Edition).Java SE 以前称为 J2SE.它允许开发和部署在桌面.服务器.嵌入式环境和实时环境中使用的 Java 应用程 ...

  7. 深入浅出 Java Concurrency (20): 并发容器 part 5 ConcurrentLinkedQueue[转]

    ConcurrentLinkedQueue是Queue的一个线程安全实现.先来看一段文档说明. 一个基于链接节点的无界线程安全队列.此队列按照 FIFO(先进先出)原则对元素进行排序.队列的头部 是队 ...

  8. httpclient遇到java.net.URISyntaxException: Illegal character in scheme name at index 0:

    正准备按照大佬的解决办法处理, 看会一条回复,说url有空格 检查了一下,还真是有空格 去除url中的空格,问题解除

  9. js中的自执行匿名函数 (function(){})()

    JS函数有两种命名方式 1.声明式 声明式会导致函数提升,function会被解释器优先编译.即我们用声明式写函数,可以在任何区域声明,不会影响我们调用. function XXX(){} 2.函数表 ...

  10. Java程序员面试题收集(5)

    Java基础方面: 1.作用域public,private,protected,以及不写时的区别 答:区别如下: 作用域 当前类 同一package 子孙类 其他package public √ √ ...