官网:

https://mybatis.plus/

https://gitee.com/baomidou/mybatis-plus

https://github.com/baomidou/mybatis-plus

1.引入依赖:

 		<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.1.tmp</version>
</dependency>

2.编写自己接口继承BaseMapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

@Repository
public interface StuDescMapper extends BaseMapper<StuDesc> {}

3.设置yml文件,官方配置介绍https://mybatis.plus/config/

spring:
datasource:
name: student_info
url: jdbc:mysql://127.0.0.1:3306/student_info?serverTimezone=GMT%2B8
username: root
password: test
driver-class-name: com.mysql.cj.jdbc.Driver server:
port: 9090 #根据自己的需求配置
mybatis-plus:
mapperLocations: classpath:mapper/*.xml
configuration :
mapUnderscoreToCamelCase: true
globalConfig:
banner: true

4.编辑实体,官方注解说明https://mybatis.plus/guide/annotation.html

@TableName(value = "s_desc")
public class StuDesc {
private String id;
@TableId
private Integer userId;
private String scoreLevel;
@TableField(value = "`desc`")
private String desc;

5.crdu的使用

查询条件的构造:

QueryWrapper<StuDesc> stuDescQueryWrapper = new QueryWrapper<>();

(1)QueryWrapper可以直接填充实体StuDesc,根据实体的内容去执行;

(2)QueryWrapper也可构造添加去执行,stuDescQueryWrapper.eq(“表字段名”,“具体的值”);

附加:MyBatis-Plus功能很强大,还有很多功能可以使用,

CRUD 接口:https://mybatis.plus/guide/crud-interface.html

条件构造器:https://mybatis.plus/guide/wrapper.html

最新文章

  1. 【分布式协调】之理解paxos
  2. iOS开发UIScrollView的底层实现
  3. HP-Socket
  4. Raspberry Pi3 ~ 搭建开发环境
  5. ZOJ 2015 10月份 月赛 3911 Prime Query
  6. homebrew for mac
  7. 基于Spring Boot的图片上传
  8. K:Union-Find(并查集)算法
  9. A tuple is defined as a function
  10. Lodop打印语句最基本结构介绍(什么是一个任务)
  11. VS2017+WIN10自动生成类、接口的说明(修改类模板的方法)
  12. error C4996: &#39;GetVersionExW&#39;: 被声明为已否决
  13. 1finally与return、exit()
  14. 【Jenkins学习 】解决jenkins运行磁盘满的问题
  15. [javaSE] GUI(对话框Dialog)
  16. 【移动端debug-1】css3中box-shadow的溢出问题
  17. xeno 实时性能测试 在100us的采样周期的测试数据
  18. Oracle11gr2_ADG管理之switchover补充
  19. git push &amp; git pull 推送/拉取分支
  20. python 循环内部添加多个条件判断会出现越界

热门文章

  1. ORM单表查询,跨表查询,分组查询
  2. Oracle连接别人数据库
  3. POJ1523 Tarjan求割点以及删除割点之后强连通分量的数量
  4. CF1326A Bad Ugly Numbers 题解
  5. React Hook上车
  6. 动态规划-不连续最大子序列和-打家劫舍系列-1388. 3n 块披萨
  7. C 2012年笔试题(保)
  8. leetcode并发题解
  9. 用一个例子说说gRPC的四种服务方法
  10. 值传递:pass by value(按值传递) 和 pass by reference(引用传递)-[all]-[编程原理]