Pu Zhibing
2025-03-26 7f26677ab7f9b83697370fa142dd1686cdf4082a
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
package com.ruoyi.order.enums;
 
import lombok.Getter;
 
@Getter
public enum OrderType {
    SERVICE(1, "服务单"),
    GOOD(2, "商品单");
 
    private final int code;
    private final String description;
 
    OrderType(int code, String description) {
        this.code = code;
        this.description = description;
    }
 
    public static OrderType fromCode(int code) {
        for (OrderType type : OrderType.values()) {
            if (type.getCode() == code) {
                return type;
            }
        }
        return null;
    }
}