package com.panzhihua.common.enums; import lombok.Getter; /** * 人员类型 * * @author tangxb */ @Getter public enum PopulPersonTypeEnum { HJ(1, "户籍人口"), LS(2, "留守人员"), WD(3, "外地人员"), JW(4, "境外人员"), LD(5, "流动人口"), CZ(6, "常住人口"), ZZ(7, "暂住人口"); private final Integer code; private final String name; PopulPersonTypeEnum(Integer code, String name) { this.code = code; this.name = name; } public static int getCodeByName(String name) { for (PopulPersonTypeEnum item : PopulPersonTypeEnum.values()) { if (item.name.equals(name)) { return item.getCode(); } } return -1; } public static String getCnDescByName(Integer code) { for (PopulPersonTypeEnum item : PopulPersonTypeEnum.values()) { if (item.code.equals(code)) { return item.getName(); } } return "其他"; } }