zss
13 小时以前 f68d79d0ff6658795c19c2fd473fab9ff6f0640d
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.ruoyi.production.enums;
 
/**
 * <br>
 * 物料配置类型枚举
 * </br>
 *
 * @author deslrey
 * @version 1.0
 * @since 2026/03/11 17:24
 */
public enum MaterialConfigTypeEnum {
 
    /**
     * 物料类型
     */
    MATERIAL_TYPE(1, "物料类型"),
 
    /**
     * 存货类别
     */
    INVENTORY_CAT(2, "存货类别");
 
    private final Integer type;
    private final String desc;
 
    MaterialConfigTypeEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }
 
    public Integer getType() {
        return type;
    }
 
    public String getDesc() {
        return desc;
    }
 
    /**
     * 根据 type 获取枚举
     */
    public static MaterialConfigTypeEnum getByType(Integer type) {
        for (MaterialConfigTypeEnum value : values()) {
            if (value.type.equals(type)) {
                return value;
            }
        }
        return null;
    }
 
    /**
     * 根据 type 获取数据库存储值
     */
    public static String getConfigType(Integer type) {
        MaterialConfigTypeEnum e = getByType(type);
        if (e == null) {
            throw new IllegalArgumentException("配置类型错误");
        }
        return e.name();
    }
}