ustcyc
2025-01-07 de5d55508afd27fb2b47e6d4d6fd9984525c222c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.zhitan.common.enums;
 
import lombok.AllArgsConstructor;
import lombok.Getter;
 
@Getter
@AllArgsConstructor
public enum ElectricityTypeEnum {
    SHARP("尖"),
    PEAK("峰"),
    FLAT("平"),
    VALLEY("谷");
 
    private final String desc;
 
    public static String getNameByType(String type) {
        for (ElectricityTypeEnum electricityType : ElectricityTypeEnum.values()) {
            if (electricityType.name().equalsIgnoreCase(type)) {
                return electricityType.name();
            }
        }
        throw new IllegalArgumentException("Invalid electricity type: " + type);
    }
}