第一种方法: 在实体类中添加 自增 @TableId(type = IdType.AUTO) private Long id;
第二种方法
在yml文件中添加,全局自增
mybatis-plus: configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl global-config: db-config: id-type: auto
雪花算法
@TableId(type = IdType.ASSIGN_ID)
private Long id;