package com.ruoyi.basic.enums; public enum TestPorjectTypeEnums { RAW_MATERIALS("1","原辅材"), FINISHED_PRODUCT("2","成品"), SEMI_FINISHED_PRODUCT("3","半成品"), PURCHASED_PART("4","外购件"), PACKAGING_MATERIALS("5","包材"); private String code; private String name; TestPorjectTypeEnums(String code, String name) { this.code = code; this.name = name; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getName() { return name; } public void setName(String name) { this.name = name; } public static String getNameByCode(String code) { for (TestPorjectTypeEnums type : TestPorjectTypeEnums.values()) { if (type.getCode().equals(code)) { return type.getName(); } } return ""; } }