mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-01 02:38:43 +08:00 
			
		
		
		
	【代码评审】IOT:设备的 review
This commit is contained in:
		| @@ -1,19 +1,25 @@ | ||||
| package cn.iocoder.yudao.module.iot.enums.device; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | ||||
| import lombok.Getter; | ||||
|  | ||||
| import java.util.Arrays; | ||||
|  | ||||
| /** | ||||
|  * IoT 设备状态枚举 | ||||
|  * 设备状态:0 - 未激活,1 - 在线,2 - 离线,3 - 已禁用 | ||||
|  * | ||||
|  * @author haohao | ||||
|  */ | ||||
| @Getter | ||||
| public enum IotDeviceStatusEnum { | ||||
| public enum IotDeviceStatusEnum implements IntArrayValuable { | ||||
|  | ||||
|     INACTIVE(0, "未激活"), | ||||
|     ONLINE(1, "在线"), | ||||
|     OFFLINE(2, "离线"), | ||||
|     DISABLED(3, "已禁用"); | ||||
|  | ||||
|     public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(IotDeviceStatusEnum::getStatus).toArray(); | ||||
|  | ||||
|     /** | ||||
|      * 状态 | ||||
|      */ | ||||
| @@ -40,4 +46,10 @@ public enum IotDeviceStatusEnum { | ||||
|     public static boolean isValidStatus(Integer status) { | ||||
|         return fromStatus(status) != null; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public int[] array() { | ||||
|         return ARRAYS; | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV