1.@TableName=(value="对应数据库中得的名称")
2.类需要继承Model<相应类的名称>,主键需要添加自增
@TableName(value="bs_book") public class Book extends Model{ @TableId(type = IdType.AUTO) private Integer id; //这是下边定义的那个枚举类 private Category category; }
3.枚举值的对应
@Getter //用来取数据库中的数据
public enum Category {
SELECTED(1,"精选图书"),RECOMMEND(2,"推荐图书"),BARGAIN(3,,"特价图书");
Category(int code,String desc){
this.code =code;
this.desc = desc;
}
//在需要存入数据库的字段上加上@EnumValue注解
@EnumValue
private final int code;
private final String desc;
}
需要在yml文件中加入枚举配置信息
mybatis-plus:
mapper-locations:classpath*:mapper
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}



