版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
@Test
public void testInsertUser() {
User user = new User();
user.setAge(18);
user.setName("村上春树");
user.setPassword("123456");
user.setUserName("cuncun");
user.setSex(3);
user.setBirthday(new Date()
this.userMapper.insertUser(user);
}
出现这个错误的原因是把username设置为了唯一的字段,所以不能重复,当"cuncun"当重复多次运行,就会报这个错,以此为鉴,这样的问题百度出来的都是别人写的比较复杂的,是因为这样的问题比较简单,一般人不会写这样的error. Fighting!!!