archive file
parent
884e3b2ea4
commit
1f9dc83d8d
|
|
@ -0,0 +1,61 @@
|
|||
package org.qinan.safetyeval.domain.constant;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* 文件来源枚举
|
||||
*/
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public enum ProjectArchiveFileSourceEnum {
|
||||
|
||||
/**
|
||||
* 流程自动记录
|
||||
*/
|
||||
AUTO_PROCESS_RECORD("auto_process_record", "流程自动记录"),
|
||||
|
||||
/**
|
||||
* 补充上传
|
||||
*/
|
||||
UPLOAD_ADDITIONAL_FILES("upload_additional_files", "补充上传");
|
||||
|
||||
/**
|
||||
* 编码,用于数据库存储
|
||||
*/
|
||||
private final String code;
|
||||
|
||||
/**
|
||||
* 中文描述,用于界面展示
|
||||
*/
|
||||
private final String desc;
|
||||
|
||||
public static final String REMARKS = "文件来源 auto_process_record:流程自动记录, upload_additional_files:补充上传";
|
||||
|
||||
/**
|
||||
* 根据编码获取枚举
|
||||
*/
|
||||
public static ProjectArchiveFileSourceEnum fromCode(String code) {
|
||||
if (code == null || code.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
for (ProjectArchiveFileSourceEnum type : values()) {
|
||||
if (type.code.equals(code)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("未知的文件来源编码: " + code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据编码获取描述,找不到时返回原编码
|
||||
*/
|
||||
public static String getDescByCode(String code) {
|
||||
for (ProjectArchiveFileSourceEnum type : values()) {
|
||||
if (type.code.equals(code)) {
|
||||
return type.desc;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue