package com.ruoyi.common.enums; /** * Created by Jiangyue on 2022/1/18. */ public enum Education { DOCTOR("doctor", "博士"), MASTER("master","硕士"), BACHELOR("bachelor","本科"), COLLEGE("college","专科"), SENIORHIGHSCHOOL("seniorhighschool","高中"), JUNIORHIGHSCHOOL("juniorhighschool","初中"), PRIMARYSCHOOL("primaryschool","小学"), PRESCHOOL("preschool","学前"); private String code; private String desc; Education(String code, String desc) { this.code = code; this.desc = desc; } public static String getDescByCode(String code) { Education[] educations = values(); for (int i = 0; i < educations.length; i++) { Education education = educations[i]; if (code.trim().equals(education.getCode())) { return education.getDesc(); } } return null; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } }