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

使用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>{...}
发布了2 篇原创文章 · 获赞 0 · 访问量 25

猜你喜欢

转载自blog.csdn.net/guashengzan0281/article/details/104312030