缺陷管理BUG修复
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package com.test.common.enums;
|
||||
|
||||
/**
|
||||
* @author liangdaliang
|
||||
* @Description:缺陷状态枚举
|
||||
* @date 2025-04-23 13:59
|
||||
*/
|
||||
public enum EnumDefectStatus {
|
||||
PENDING_CONFIRMATION("0", "待确认"),
|
||||
UNDER_REPAIR("1", "修复中"),
|
||||
COMPLETED("2", "已完成"),
|
||||
INVALID_DEFECT("3", "无效缺陷"),
|
||||
SUSPENDED("4", "挂起"),
|
||||
PENDING_VERIFICATION("5", "待验证");
|
||||
|
||||
private final String code;
|
||||
private final String description;
|
||||
|
||||
EnumDefectStatus(String code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态码获取对应的枚举值
|
||||
*/
|
||||
public static EnumDefectStatus fromCode(String code) {
|
||||
for (EnumDefectStatus status : values()) {
|
||||
if (status.code.equals(code)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("无效的状态码: " + code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态码获取中文描述(可选)
|
||||
*/
|
||||
public static String getDescriptionByCode(String code) {
|
||||
return fromCode(code).getDescription();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.test.common.enums;
|
||||
|
||||
/**
|
||||
* @author liangdaliang
|
||||
* @Description:缺陷严重程度枚举
|
||||
* @date 2025-04-23 14:06
|
||||
*/
|
||||
public enum EnumSeverityLevel {
|
||||
INVALID("0", "无效"),
|
||||
MINOR("1", "轻微"),
|
||||
MODERATE("2", "一般"),
|
||||
SEVERE("3", "严重"),
|
||||
CRITICAL("4", "致命");
|
||||
|
||||
private final String code;
|
||||
private final String description;
|
||||
|
||||
EnumSeverityLevel(String code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据严重程度码获取枚举实例
|
||||
*/
|
||||
public static EnumSeverityLevel fromCode(String code) {
|
||||
for (EnumSeverityLevel level : values()) {
|
||||
if (level.code.equals(code)) {
|
||||
return level;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("无效的严重程度码: " + code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态码直接获取中文描述
|
||||
*/
|
||||
public static String getDescriptionByCode(String code) {
|
||||
return fromCode(code).getDescription();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user