Commit 8380893a by 刘宇峰

根据业务类型获取设备类型

1 parent 9ba19e14
...@@ -2,6 +2,8 @@ package cn.com.glsx.devicemonitor.api.enums; ...@@ -2,6 +2,8 @@ package cn.com.glsx.devicemonitor.api.enums;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.Objects;
/** /**
* @author wangxw * @author wangxw
* @version 1.0.0 * @version 1.0.0
...@@ -44,24 +46,9 @@ public enum DeviceTypeRelationEnum { ...@@ -44,24 +46,9 @@ public enum DeviceTypeRelationEnum {
this.deviceName = deviceName; this.deviceName = deviceName;
} }
public String getDeviceCode() {
return deviceCode;
}
public Integer getBizDeviceType() {
return bizDeviceType;
}
public Integer getDataDeviceType() {
return dataDeviceType;
}
public String getDeviceName() {
return deviceName;
}
/** /**
* 通过业务设备类型查询 枚举 * 通过业务设备类型查询 枚举
*
* @param deviceCode * @param deviceCode
* @return * @return
*/ */
...@@ -80,4 +67,41 @@ public enum DeviceTypeRelationEnum { ...@@ -80,4 +67,41 @@ public enum DeviceTypeRelationEnum {
return null; return null;
} }
/**
* 通过业务设备类型查询 枚举
*
* @param deviceType
* @return
*/
public static DeviceTypeRelationEnum findByBizDeviceType(Integer deviceType) {
if (Objects.isNull(deviceType)) {
return null;
}
DeviceTypeRelationEnum[] dataArray = DeviceTypeRelationEnum.values();
for (int i = 0; i < dataArray.length; i++) {
DeviceTypeRelationEnum deviceTypeRelationEnum = dataArray[i];
if (deviceTypeRelationEnum.getBizDeviceType().equals(deviceType)) {
return deviceTypeRelationEnum;
}
}
return null;
}
public String getDeviceCode() {
return deviceCode;
}
public Integer getBizDeviceType() {
return bizDeviceType;
}
public Integer getDataDeviceType() {
return dataDeviceType;
}
public String getDeviceName() {
return deviceName;
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!