1.自定义报表模板调整

This commit is contained in:
2025-11-26 14:41:23 +08:00
parent 61c8656fd9
commit ea54b2b907
6 changed files with 100 additions and 27 deletions

View File

@@ -11,7 +11,7 @@ public enum CsTransientEnum {
EVT_SYS_DIPSTR("Evt_Sys_DipStr","电压暂降"),
EVT_SYS_INTRSTRr("Evt_Sys_IntrStr","电压中断"),
EVT_SYS_INTRSTR("Evt_Sys_IntrStr","电压中断"),
EVT_SYS_SWLSTR("Evt_Sys_SwlStr","电压暂升"),
TRANSIENT("Transient","录波"),
UN_KNOW("Un_Know","未知")
@@ -27,4 +27,26 @@ public enum CsTransientEnum {
this.code = code;
this.name = name;
}
/**
* 根据code获取对应的name
* @param code 枚举编码
* @return 匹配的名称,未匹配时返回"未知"code为null时返回"未知"
*/
public static String getNameByCode(String code) {
// 处理code为null的情况
if (code == null) {
return UN_KNOW.getName();
}
// 遍历所有枚举常量匹配code
for (CsTransientEnum transientEnum : CsTransientEnum.values()) {
if (transientEnum.getCode().equals(code)) {
return transientEnum.getName();
}
}
// 未找到匹配的code时返回未知名称
return UN_KNOW.getName();
}
}