拓冰建站拓冰建站
首页 / 资讯中心 / 正文

SpringBoot学习之直接使用枚举Enum(基于Mybatis-Plus)(五十一)

该实例基于Springboot、Mybatis-Plus、Knife4j、MySQL等技术。1、‌使用@JsonValue注解‌:在枚举类中,通过@JsonValue注解标记返回给前端的字段。package com.xu.websocket.model.enums; import com.baomidou.mybatisplus.annotation.EnumValue; import com.fasterxml.jackson.annotation.JsonValue; import lombok.AllArgsConstructor; import lombok.Getter; @AllArgsConstructor @Getter public enum StatusEnum { CREATED(1, "已创建"), PAID(2, "已支付"), SHIPPED(3, "已发货"), COMPLETED(4, "已完成"); @EnumValue private final Integer code; @JsonValue private final String name; @JsonCre
分享:

看完干货,该让你的企业上线了

免费需求沟通 · 48 小时内出具建站方案 · 河南本地可上门