mybatis出现There is no getter for property named ‘Id‘ in ‘class com.baomidou.mybatisplus
记录一下我在工作中犯的错误,使用 mybatis-plus 时出现 There is no getter for property named ‘id’ in ‘class com.baomidou.mybatisplus.core.conditions.query.QueryWrapper’ 的报错
这个报错咋一看,还以为是 id 没有 get、set 方法,但我去看实体类代码是有的,所以我就去我使用 mybatis-plus 的地方,发现 getById(Serializable id) 方法用错了,这个方法是传id即可,但是我传了一个 mybatis-plus 条件构造器,这个返回是单个对象,而我是要条件查询返回一条数据,所以改成 selectOne即可。