package com.xjrsoft.common.enums; public enum GenderIntEnum { /** * 男 */ MALE("SB10001", 1), /** * 女 */ FEMALE("SB10002", 2); final String code; final Integer value; public String getCode() { return this.code; } public Integer getValue() { return this.value; } public static Integer getValue(String code) { for (GenderIntEnum item : values()) { if (item.getCode().equals(code)) { return item.getValue(); } } return null; } GenderIntEnum(final String code, final Integer message) { this.code = code; this.value = message; } public static String getCode(Integer value) { for (GenderIntEnum item : values()) { if (item.getValue() == value) { return item.getCode(); } } return null; } }