上一章我们mybatis环境已经成功完成,编写测试用例,测试
@SpringBootTest
class MybatisPlusdemoApplicationTests {
@Autowired
private UserMapper userMapper;
@Test
void contextLoads() {
List<User> users = userMapper.selectList(null);
users.forEach(System.out::println);
}
@Test
public void testInsert(){
User user = new User();
user.setName("看");
user.setAge(1);
user.setEmail("1461760249@qq.com");
int result = userMapper.insert(user);
System.out.println(result);
System.out.println(user);
}
}
插入成功