liding
5 天以前 dc5e5c07549b493e21c11dc7929c32ea9fd732b0
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
package com.ruoyi.approve.enums;
 
import java.util.Arrays;
 
public enum ApproveType {
    FREE_COLLABORATION(1, "自由协同审批"),
    LEAVE(2, "请假管理"),
    SALES_CONTRACT(3, "销售审批"),
    REIMBURSEMENT(4, "报销审批"),
    PURCHASE_PLAN(5, "采购审批"),
    QUOTATION(6, "报价审批"),
    OUTBOUND(7, "出库审批");
 
    private final int code;
    private final String label;
 
    ApproveType(int code, String label) {
        this.code = code;
        this.label = label;
    }
 
    public int getCode() {
        return code;
    }
 
    public String getLabel() {
        return label;
    }
 
    public static ApproveType fromCode(Integer code) {
        return Arrays.stream(values()).filter(item -> item.code == code).findFirst()
                .orElseThrow(() -> new IllegalArgumentException("不支持的审批类型"));
    }
}