【功能完善】IoT: 添加插件和插件实例管理功能,包括插件信息的增删改查接口,支持文件上传和状态更新,同时优化了枚举类型的处理逻辑。
This commit is contained in:
@@ -34,12 +34,10 @@ public enum IotPluginDeployTypeEnum implements IntArrayValuable {
|
||||
}
|
||||
|
||||
public static IotPluginDeployTypeEnum fromDeployType(Integer deployType) {
|
||||
for (IotPluginDeployTypeEnum value : values()) {
|
||||
if (value.getDeployType().equals(deployType)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return Arrays.stream(values())
|
||||
.filter(value -> value.getDeployType().equals(deployType))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
public static boolean isValidDeployType(Integer deployType) {
|
||||
|
@@ -34,12 +34,10 @@ public enum IotPluginStatusEnum implements IntArrayValuable {
|
||||
}
|
||||
|
||||
public static IotPluginStatusEnum fromState(Integer state) {
|
||||
for (IotPluginStatusEnum value : values()) {
|
||||
if (value.getStatus().equals(state)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return Arrays.stream(values())
|
||||
.filter(value -> value.getStatus().equals(state))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -35,14 +35,11 @@ public enum IotPluginTypeEnum implements IntArrayValuable {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
// TODO @haohao:可以使用 hutool 简化
|
||||
public static IotPluginTypeEnum fromType(Integer type) {
|
||||
for (IotPluginTypeEnum value : values()) {
|
||||
if (value.getType().equals(type)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return Arrays.stream(values())
|
||||
.filter(value -> value.getType().equals(type))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
public static boolean isValidType(Integer type) {
|
||||
|
Reference in New Issue
Block a user