按照视频教程,运行测试类报错 @Data public class User { private Long id; private String name; private Integer age; private String email; private Long managerid; private LocalDateTime createTime; } ### Cause: java.sql.SQLSyntaxErrorException: Unknown column 'managerid' in 'field list'; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Unknown column 'managerid' in 'field list' managerid字段不存在。 修改user类的可以成功运行但manager_id全部为null @Data public class User { private Long id; private String name; private Integer age; private String email; private Long manager_id; private LocalDateTime createTime; } User(id=1087982257332887553, name=大boss, age=40, email=boss@baomidou.com, manager_id=null, createTime=2019-01-11T14:20:20)User(id=1088248166370832385, name=王天风, age=25, email=wtf@baomidou.com, manager_id=null, createTime=2019-02-05T11:12:22)User(id=1088250446457389058, name=李艺伟, age=28, email=lyw@baomidou.com, manager_id=null, createTime=2019-02-14T08:31:16)User(id=1094590409767661570, name=张雨琪, age=31, email=zjq@baomidou.com, manager_id=null, createTime=2019-01-14T09:15:15)User(id=1094592041087729666, name=刘红雨, age=32, email=lhm@baomidou.com, manager_id=null, createTime=2019-01-14T09:48:16)
managerId的I在实体类中大写,遵守驼峰原则
MyBatis遵循的是驼峰命名法,把i改成大写就可以了