mybatisplus 3.4.2 无法批量插入
时间: 2023-09-12 11:04:09 浏览: 186
要实现mybatis-plus 3.4.2的批量插入功能,你可以按照以下步骤进行配置:
1. 在你的项目中引入mybatis-plus的依赖。你可以在pom.xml文件中添加以下代码:
```xml
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>3.4.2</version>
</dependency>
```
2. 导入mysql驱动和mybatis-plus-boot-starter的依赖。你可以在pom.xml文件中添加以下代码:
```xml
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.2</version>
</dependency>
```
3. 编写主配置文件,包括数据库连接配置和日志配置。你可以在application.yml(或application.properties)文件中添加以下代码:
```yaml
spring:
datasource:
url: jdbc:mysql://localhost:3306/mybatis_plus?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF-8
username: root
password: 19955
driver-class-name: com.mysql.cj.jdbc.Driver
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
```
4. 配置批量插入功能。mybatis-plus 3.4.2 默认是支持批量插入的,不需要额外的配置。
通过以上步骤,你的项目就可以使用mybatis-plus 3.4.2的批量插入功能了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [MyBatisPlus_最新版(3.4.2)_整合Boot](https://blog.csdn.net/weixin_43206491/article/details/115487367)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [MybatisPlus(3.4.2)简易学习笔记](https://blog.csdn.net/a_letter/article/details/114667729)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文