xin
2025-10-17 ab0637e981ab4c85120ccde35ee24ec4abbe3e24
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
33
34
35
36
37
38
39
40
41
package com.oying.modules.fee.utils.enums;
 
import lombok.AllArgsConstructor;
import lombok.Getter;
 
/**
 * @author xin
 * @description
 * @date 2025/10/7 22:59
 */
@Getter
@AllArgsConstructor
public enum CategoryTypeEnum {
 
    NORMAL("normal", "普通品类"),
    SPECIAL("special", "特殊品类"),
 
    UNKNOWN("UNKNOWN", "未知枚举");
 
    private final String key;
 
    private final String value;
 
    public static CategoryTypeEnum find(String val) {
        for (CategoryTypeEnum value : CategoryTypeEnum.values()) {
            if (val.equals(value.getKey())) {
                return value;
            }
        }
        return UNKNOWN;
    }
 
    public static String getValue(String val) {
        for (CategoryTypeEnum value : CategoryTypeEnum.values()) {
            if (val.equals(value.getKey())) {
                return value.getValue();
            }
        }
        return UNKNOWN.getValue();
    }
}