yanderong
2026-10-02 f50643366a89ea4548cabddf3cbc783605a6f167
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
package com.ruoyi.other.domain;
 
public enum PlatformEnum {
 
    KSTAR(0, "科士达"),
    HUAWEI(1, "华为"),
    SUNGROW(2, "阳光"),
    GROWATT(3, "古瑞瓦特"),
    OULITE(4, "欧力特");;
 
 
    private final Integer code;
    private final String name;
 
    PlatformEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }
 
    public Integer getCode() {
        return code;
    }
 
    public String getName() {
        return name;
    }
 
    /**
     * 根据code获取枚举
     */
    public static PlatformEnum getByCode(Integer code) {
        for (PlatformEnum item : values()) {
            if (item.code.equals(code)) {
                return item;
            }
        }
        return null;
    }
}