1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
| package com.ruoyi.order.enums;
|
| import lombok.Getter;
|
| @Getter
| public enum OrderStatus {
| PENDING_SHIPMENT(1, "待发货"),
| PENDING_RECEIPT(2, "待收货"),
| PENDING_USE(3, "待使用"),
| COMPLETED(4, "已完成"),
| CANCELLED(5, "已取消"),
| REFUNDED(6, "已退款"),
| AFTER_SALE(7, "售后中");
|
| private final int code;
| private final String description;
|
| OrderStatus(int code, String description) {
| this.code = code;
| this.description = description;
| }
|
| // 根据代码获取对应的OrderStatus
| public static OrderStatus fromCode(int code) {
| for (OrderStatus status : values()) {
| if (status.getCode() == code) {
| return status;
| }
| }
| throw new IllegalArgumentException("Unknown order status code: " + code);
| }
| }
|
|