此项目为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. JS实用插件

    1. jQuery鼠标滚轮事件插件Mouse Wheel 下载链接:https://github.com/brandonaaron/jquery-mousewheel/ 使用方法: // using ...

  2. C++面向对象高级编程(下)-Geekband

    11, 组合和继承 一, Composition 复合  has-a的关系 简单来讲, 就是: class A{     classB b1;   }; 这里讲到Adapter设计模式: templa ...

  3. [转]使用RDLC报表

    使用RDLC报表(一) 1       建立数据源 启动VS2005新建一个窗体项目,命名为TestProj 在左边的窗体内选择“添加新数据源”或在菜单上操作“添加新数据源”: 选择后出现对话窗体,选 ...

  4. vue 学习 二

    动画 <transition name="fade"> <p v-if="show">hello</p> </tran ...

  5. 一维、二维数组 与 常用的返回数组 以及 fetch_all与fetch_row的区别

    一维数组:单行单列的数组. 二维数组:多行多列的数组.       (至少两行两列) 索引数组: fetch_all() 返回所有数组 fetch_row() 返回一行或一列数组  (第二行需要输入两 ...

  6. 《DSP using MATLAB》Problem 7.29

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  7. HDFS写数据的过程

  8. springmvc:配置解决中文乱码的过滤器

    在web.xml中配置以下内容: <!--配置解决中文乱码过滤器--> <filter> <filter-name>characterEncodingFilter& ...

  9. Luogu P1092 虫食算(枚举+剪枝)

    P1092 虫食算 题面 题目描述 所谓虫食算,就是原先的算式中有一部分被虫子啃掉了,需要我们根据剩下的数字来判定被啃掉的字母.来看一个简单的例子: 43#9865#045 + 8468#6633 4 ...

  10. IDEA javax.servlet.http.HttpServletRequest; 不存在 解决方案

    使用idea创建一个web项目,在项目中报HttpServletRequest和HttpServletResponse不存在. 问题原因:idea不会默认引用tomcat的jar包. 解决方法: [注 ...