package enumeration.general; import com.baomidou.mybatisplus.annotation.EnumValue; import com.fasterxml.jackson.annotation.JsonValue; import lombok.Getter; @Getter public enum PublishType { UNPUBLISHED("UNPUBLISHED", "未发布"), PUBLISHED("PUBLISHED", "已发布"); @EnumValue // 标明该字段存入数据库 @JsonValue // 标明在转JSON时使用该字段,即响应时 private final String code; private final String desc; PublishType(String code,String desc) { this.code = code; this.desc = desc; } }