云
2026-09-29 f87ce86307056f63f79312178037cc8714eb2b13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package cn.iocoder.yudao.module.archive.enums;
 
import cn.hutool.core.util.ArrayUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
 
/**
 * 档案来源类型枚举
 *
 * @author 超级管理员
 */
@Getter
@AllArgsConstructor
public enum ArchiveSourceTypeEnum {
 
    MANUAL(1, "手工录入"),
    RESEARCH(2, "课题"),
    MEMBER(3, "会员"),
    FINANCE(4, "财务"),
    ;
 
    private final Integer type;
    private final String name;
 
    public static ArchiveSourceTypeEnum valueOf(Integer type) {
        return ArrayUtil.firstMatch(e -> e.getType().equals(type), values());
    }
 
    /** 按来源值取中文名,未匹配时回退原始值,便于错误提示可读 */
    public static String nameOf(Integer type) {
        ArchiveSourceTypeEnum item = valueOf(type);
        return item != null ? item.getName() : String.valueOf(type);
    }
 
}