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; } }