manailin
2021-06-12 7a2e1fd9e34ab58caf9fa8565e94dd9fcd174a1a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.panzhihua.common.enums;
 
import lombok.Getter;
 
/**
 * 文化程度
 * 
 * @author huanghongfa
 */
@Getter
public enum PopulCultureLevelEnum
{
    XX(1, "小学"),
    CZ(2, "初中"),
    GZ(3, "高中"),
    ZZ(4, "中专"),
    DZ(5, "大专"),
    BK(6, "本科"),
    SS(7, "硕士"),
    BS(8, "博士"),
    QT(9, "其他");
 
    private final Integer code;
    private final String name;
 
    PopulCultureLevelEnum(Integer code, String name)
    {
        this.code = code;
        this.name = name;
    }
 
    public static int getCodeByName(String name) {
        for (PopulCultureLevelEnum item : PopulCultureLevelEnum.values()) {
            if (item.name.equals(name)) {
                return item.getCode();
            }
        }
        return QT.getCode();
    }
 
    public static String getCnDescByName(Integer code) {
        for (PopulCultureLevelEnum item : PopulCultureLevelEnum.values()) {
            if (item.code.equals(code)) {
                return item.getName();
            }
        }
        return "其他";
    }
 
}