123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package com.xy.utils.enums;
- import lombok.AllArgsConstructor;
- import lombok.Getter;
- import lombok.ToString;
- /**
- * 锁机状态 1 未锁机 2 已锁机
- *
- * @author 谭斌
- */
- @Getter
- @ToString
- @AllArgsConstructor
- public enum DeviceLockState {
- UN_LOCK(1, "未锁机"),
- LOCK(2, "已锁机");
- /**
- * 编码值
- */
- private Integer code;
- /**
- * 描述
- */
- private String description;
- /**
- * 通过code获取enum
- *
- * @param code
- * @return
- */
- public static DeviceLockState getEnumByCode(Integer code) {
- DeviceLockState[] values = values();
- for (DeviceLockState value : values) {
- if (value.getCode().equals(code)) {
- return value;
- }
- }
- return null;
- }
- }
|