Springboot集成mybatis-plus报com.xly.entity.ClientNot Found TableInfoCache.

流过昼夜 提交于 2020-02-15 02:21:48

使用mybatis-plus版本为 3.1.0,springboot版本为2.2.4.RELEASE

  1. 实体类继承Model 泛型为该实体类 ,泛型一定要写,我就是因为这个报错
@Data
@TableName("t_user_expand")
@KeySequence(value = "t_user_expand_id_seq")
@EqualsAndHashCode(callSuper = false)
public class UserExpand extends Model<UserExpand> {...}
  1. 重写Model类的pkVal()方法,return当前类的主键
@Override
protected Serializable pkVal() {
    return id;
}
  1. 实体类需要有对应的Mapper 并且该Mapper继承BaseMapper 泛型为该实体类
public interface UserExpandMapper extends BaseMapper <UserExpand>{...}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!