liyong
2026-04-28 6b908076f80a2c2933058caf5311ae2dc9048409
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
package com.ruoyi.basic.enums;
 
public enum ApplicationTypeEnum {
    IMAGE("image"),
    FILE("file"),
    AFTER_FILE("after_file"),
    BEFORE_FILE("before_file"),
    APK("apk");
 
 
    private final String type;
    ApplicationTypeEnum(String type) { this.type = type; }
    public String getType() { return type; }
 
    /**
     * 根据 type 值获取对应的枚举实例
     * @param type 应用类型字符串
     * @return 对应的 ApplicationTypeEnum 枚举实例
     * @throws RuntimeException 如果 type 无效
     */
    public static ApplicationTypeEnum getByType(String type) {
        for (ApplicationTypeEnum enumValue : ApplicationTypeEnum.values()) {
            if (enumValue.getType().equals(type)) {
                return enumValue;
            }
        }
        throw new RuntimeException("无效的应用类型: " + type);
    }
}