@JSONField com.alibaba.fastjson.annotation
在使用 fastJson,将 object 转换成 jsonString,时间会按照该注解的格式进行格式化
@JsonFormat com.alibaba.fastjson.annotation
接收前端参数时,时间格式要和该注解的格式一致
@EnumValue com.baomidou.mybatisplus.annotation
mybatisplus 从数据库中读取数据时,会将对应的值转换成相应的枚举
@JsonValue com.fasterxml.jackson.annotation
接口返回时,会将枚举中使用该注解的字段的值返回
例如:
class User {
private String name;
private UserTypeEnum userType;
}
enum UserTypeEnum {
STUDENT(0, "学生"),
TEACHER(1, "教师"),
;
@JsonValue
private Integer code;
private String desc;
}
最后接口返回的就是 {"name": "", "userType": 枚举中的code值}