批量拼接SQL
<!-- 批量拼接SQL 如100条一次 -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>22.0</version>
</dependency>
实现如下:每100条数据拼接一条SQL
@Override
public int upsert(List<Company> companyList) {
List<List<Company>> upsertList = Lists.partition(companyList, 100);
int result = 0;
for (List<Company> companies : upsertList) {
result += companyMapper.upsert(companies);
}
return result;
}