package com.example.smart.enumlist; import java.io.Serializable; public enum DeviceType implements Serializable { TOWER_CRANE("塔式起重机"), CONSTRUCTION_LIFT("施工升降机"), MATERIAL_HOIST("物料提升机"), BRIDGE_CRANE("桥式起重机"), SUSPENDED_SCAFFOLDING("附着式升降脚手架"), MOBILE_CRANE("流动式起重机"), HIGH_ALTITUDE_BASKET("高处作业吊篮"), GANTRY_CRANE("门式起重机"), GANTRY_TROLLEY_CRANE("架桥机"), OTHER("其他类型"); private final String desc; DeviceType(String desc) { this.desc = desc; } public static DeviceType getByDescription(String description) { for (DeviceType deviceType : DeviceType.values()) { if (deviceType.desc.equals(description)) { return deviceType; } } return null; } public String getDesc() { return desc; } public String hierarchyPath() { return "/" + this.ordinal(); } }