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); } }