@Test
public void inserBatch(){
User user1=new User();
user1.setName("李天意");
user1.setAge(34);
user1.setManagerId(1088248166370832385L);
User user2=new User();
user2.setName("何文博");
user2.setAge(31);
user2.setManagerId(1088248166370832385L);
List<User> asList = Arrays.asList(user1,user2);
int rows = userMapper.insertBatchSomeColumn(asList);
System.out.println("受影响行数"+rows);
}
控制台输出:
insertFill~
insertFill~
DEBUG==> Preparing: INSERT INTO user (id,deleted) VALUES (?,?) , (?,?)
DEBUG==> Parameters: 1197042953618677762(Long), null, 1197042953639649281(Long), null
DEBUG<== Updates: 2
受影响行数2