基于SpringBoot的影像注册系统03 如何集成MybatisPlus?(视频)

步骤 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的字段本来就是一样的(为了偷懒和减少出错)

最后是视频讲解:

SpringBoot影像资料注册系统-mybatisplus集成 - 知乎SpringBoot影像资料注册系统-mybatisplus集成https://www.zhihu.com/zvideo/1442084748626161664

猜你喜欢

转载自blog.csdn.net/weixin_39570751/article/details/121291088
今日推荐