Files
senmesh-zc/backend/src/main/java/com/senmesh/common/constant/GenderEnum.java

49 lines
885 B
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.senmesh.common.constant;
/**
* 性别枚举
*
*/
public enum GenderEnum {
MALE(1, "男"),
FEMALE(2, "女"),
OTHER(3, "其它");
private final Integer type;
private final String desc;
GenderEnum(Integer type, String desc) {
this.type = type;
this.desc = desc;
}
public Integer getType() {
return type;
}
public String getDesc() {
return desc;
}
public static Integer formatFemale(Integer value){
// 通过sql 身份证号处理性别条件:0女,1男
if(GenderEnum.FEMALE.getType().equals(value)){
return 0;
}
return value;
}
public static String getVal(Integer val){
if(GenderEnum.MALE.getType().equals(val)){
return GenderEnum.MALE.desc;
} else if(GenderEnum.FEMALE.getType().equals(val)){
return GenderEnum.FEMALE.desc;
}
return GenderEnum.OTHER.desc;
}
}