在枚举类上使用注解
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum InformationTypeEnum {
NEWS_INFO(1, "新闻资讯", "新闻资讯"),
COMPANY_INFO(2, "企业资讯", "企业资讯"),
PROJECT_INFO(3, "项目资讯", "项目资讯")
;
@EnumValue
final int code;
final String description;
final String message;
}
返回
"type": {
"code": 1,
"description": "新闻资讯",
"message": "新闻资讯"
}