@Getter public enum LoanInterestEnum { AVG_PRINCIPAL(0, "等额本金"), AVG_INTEREST(1, "等额本息"), FIRST_INTEREST(2, "先息后本"), ; private Integer code; private String message; LoanInterestEnum(Integer code, String message) { this.code = code; this.message = message; } public static LoanInterestEnum loanInterestEnum(int code) { for (LoanInterestEnum loanInterestEnum : LoanInterestEnum.values()) { if (code == loanInterestEnum.getCode()) { return loanInterestEnum; } } return null; } }