package com.panzhihua.common.enums;
|
|
import lombok.Getter;
|
|
/**
|
* 性别枚举
|
*
|
* @author huanghongfa
|
*/
|
@Getter
|
public enum PopulSexEnum {
|
nan(1, "男"), nv(2, "女"), weizhi(3, "未知");
|
|
private final Integer code;
|
private final String name;
|
|
PopulSexEnum(Integer code, String name) {
|
this.code = code;
|
this.name = name;
|
}
|
|
public static int getCodeByName(String name) {
|
for (PopulSexEnum item : PopulSexEnum.values()) {
|
if (item.name.equals(name)) {
|
return item.getCode();
|
}
|
}
|
return 3;
|
}
|
|
public static String getCnDescByName(Integer code) {
|
for (PopulSexEnum item : PopulSexEnum.values()) {
|
if (item.code.equals(code)) {
|
return item.getName();
|
}
|
}
|
return "未知";
|
}
|
|
}
|