前言
一、在pom.xml文件中导入依赖
<!--MyBatis-Plus:是MyBatis的增强-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.1</version>
</dependency>
配置文件
@Configuration
@MapperScan("weixinpay.pay.mapper")
@EnableTransactionManagement//启用事务管理
public class MyBatisPlusConfig {
}
优点1:驼峰和下划线的转换关系
优点2:主键自动生成策略
也就是说当前的这个类的id要和数据库当中采用相同的主键策略
优点3:可以预定义一个通用的mapper
优点4:预定义一个通用的IService
public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo> implements OrderInfoService {
}