步骤 1 pom.xml
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.1.tmp</version>
</dependency>
导入mybatis-plus的依赖
步骤 2 application.yml
mybatis-plus:
mapper-locations: classpath:mybatis/*.xml
type-aliases-package: com.app.bean
configuration:
map-underscore-to-camel-case: false
mybatis默认是属性名和数据库字段名一一对应的,即
数据库表列:user_name
实体类属性:user_name
但是java中一般使用驼峰命名
数据库表列:user_name
实体类属性:userName
这边设置成false是因为数据库字段和bean的字段本来就是一样的(为了偷懒和减少出错)
最后是视频讲解: