1.dao 文件
public interface UserMapper { Info findById(Long Id); void insert(Info info); void insertBatch(List infos); }
2.mapper文件
insert into info (id,name) values (#{info.id}, #{info.name})
3.测试
public void mainTest() { List infoList = new ArrayList<>(); Info info = new Info(); info.setName("2345"); info.setId(1012L); Info info1 = new Info(); info1.setName("2355"); info1.setId(1121L); infoList.add(info); infoList.add(info1); UserDao.getInstance().insertBatch(infoList); }