Commit 4538f5f6 authored by xixinzhao's avatar xixinzhao

fix(故障案例):列表空指针报错

parent 7be8aa05
......@@ -2,6 +2,7 @@ package com.yeejoin.equipmanage.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
......@@ -36,12 +37,14 @@ public enum EmergencyLevelEum {
}
public static String getNameByCode(String code) {
String str = null;
for(EmergencyLevelEum eum : EmergencyLevelEum.values()) {
if (code.equalsIgnoreCase(eum.getCode())) {
str = eum.getName();
break;
}
String str = "";
if (StringUtils.isNotEmpty(code)) {
for(EmergencyLevelEum eum : EmergencyLevelEum.values()) {
if (code.equalsIgnoreCase(eum.getCode())) {
str = eum.getName();
break;
}
}
}
return str;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment