springboot结合mybatis-plus查不出数据 或者 提示找不到某个实体类的主键 Can not find table primary key in Class

Can not find table primary key in Class

WARN 
WARN 
10276 
10276 
main] 
main] 
. m. core 
. m. core 
. metadata. TablelnfoHe1per 
. metadata. TablelnfoHe1per 
. Can 
Can 
find 
find 
table 
table 
primary 
primary 
key 
key 
Class: " 
Class: " 
com 
com 
. springboot . entity . Role" . 
. springboot . entity . Syssalary" .

 

可能原因是在使用Mybatis-plus-generator时由于各种原因导致自动生成的实体类或者部分实体类缺少主键注解@TableId

@Data 
@Equa1sAndHashCode(ca11Super = false) 
public class implements Serializable { 
private static final long seriaLVersionUID = IL; 
private Integer uuid;

 

手动添加一下@TableId即可

- @Data 
-@Equa1sAndHashCode(ca11Super = false) 
public class implements Serializable 
private static final long seriaLVersionUID = IL; 
@Tab1eId(va1ue = "uuid" , 
private Integer uuid; 
IdType . AUTO) 
type

posted @ 2021-10-04 23:14  夏·舍  阅读(3034)  评论(0编辑  收藏  举报