package cn.iocoder.yudao.module.research.enums;
|
|
import cn.hutool.core.util.ArrayUtil;
|
import lombok.AllArgsConstructor;
|
import lombok.Getter;
|
|
/**
|
* 课题指南类别枚举(重点/一般分类标注)
|
*
|
* @author 超级管理员
|
*/
|
@Getter
|
@AllArgsConstructor
|
public enum ResearchGuidelineCategoryEnum {
|
|
KEY(1, "重点课题"),
|
GENERAL(2, "一般课题"),
|
;
|
|
private final Integer category;
|
private final String name;
|
|
public static ResearchGuidelineCategoryEnum valueOf(Integer category) {
|
return ArrayUtil.firstMatch(e -> e.getCategory().equals(category), values());
|
}
|
|
/** 按类别值取中文名,未匹配时回退原始值,便于错误提示可读 */
|
public static String nameOf(Integer category) {
|
ResearchGuidelineCategoryEnum item = valueOf(category);
|
return item != null ? item.getName() : String.valueOf(category);
|
}
|
|
}
|