package com.ruoyi.production.enums; /** *
* 物料配置类型枚举 *
* * @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(); } }