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
package cn.iocoder.yudao.module.research.enums;
 
import cn.hutool.core.util.ArrayUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
 
/**
 * 经费拨付状态枚举
 *
 * @author 超级管理员
 */
@Getter
@AllArgsConstructor
public enum ResearchFundStatusEnum {
 
    PENDING(0, "待拨付"),
    PAID(20, "已拨付"),
    ;
 
    private final Integer status;
    private final String name;
 
    public static ResearchFundStatusEnum valueOf(Integer status) {
        return ArrayUtil.firstMatch(e -> e.getStatus().equals(status), values());
    }
 
    /** 按状态值取中文名,未匹配时回退原始值,便于错误提示可读 */
    public static String nameOf(Integer status) {
        ResearchFundStatusEnum item = valueOf(status);
        return item != null ? item.getName() : String.valueOf(status);
    }
 
}