package com.zy.core.enums; public enum CommandType { AUTO(1, "自动命令"), //自动命令 MANUAL(2, "手动命令"), //手动命令 ; public Integer id; public String desc; CommandType(Integer id, String desc) { this.id = id; this.desc = desc; } public static CommandType get(Integer id) { if (null == id) { return null; } for (CommandType type : CommandType.values()) { if (type.id.equals(id)) { return type; } } return null; } public static CommandType get(CommandType type) { if (null == type) { return null; } for (CommandType type1 : CommandType.values()) { if (type1 == type) { return type1; } } return null; } }