forked from rongchao/epmet-cloud-rizhao
5 changed files with 164 additions and 59 deletions
@ -0,0 +1,44 @@ |
|||
package com.epmet.commons.tools.enums; |
|||
|
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
|
|||
public enum GenderEnum { |
|||
MAN("1", "男"), |
|||
WOMAN("2", "女"), |
|||
UN_KNOWN("0", "未知"); |
|||
|
|||
private String code; |
|||
private String name; |
|||
|
|||
|
|||
GenderEnum(String code, String name) { |
|||
this.code = code; |
|||
this.name = name; |
|||
} |
|||
|
|||
public static String getName(String code) { |
|||
GenderEnum[] genderEnums = values(); |
|||
for (GenderEnum genderEnum : genderEnums) { |
|||
if (genderEnum.getCode() == code) { |
|||
return genderEnum.getName(); |
|||
} |
|||
} |
|||
return EpmetErrorCode.SERVER_ERROR.getMsg(); |
|||
} |
|||
|
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public void setCode(String code) { |
|||
this.code = code; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
public void setName(String name) { |
|||
this.name = name; |
|||
} |
|||
} |
@ -0,0 +1,45 @@ |
|||
package com.epmet.commons.tools.enums; |
|||
|
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
|
|||
public enum HouseTypeEnum { |
|||
//房屋类型,1楼房,2平房,3别墅
|
|||
LOUFANG("1", "楼房"), |
|||
PINGFANG("2", "平房"), |
|||
BIESHU("3", "别墅"); |
|||
|
|||
private String code; |
|||
private String name; |
|||
|
|||
|
|||
HouseTypeEnum(String code, String name) { |
|||
this.code = code; |
|||
this.name = name; |
|||
} |
|||
|
|||
public static String getName(String code) { |
|||
HouseTypeEnum[] houseTypeEnums = values(); |
|||
for (HouseTypeEnum houseTypeEnum : houseTypeEnums) { |
|||
if (houseTypeEnum.getCode() == code) { |
|||
return houseTypeEnum.getName(); |
|||
} |
|||
} |
|||
return EpmetErrorCode.SERVER_ERROR.getMsg(); |
|||
} |
|||
|
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public void setCode(String code) { |
|||
this.code = code; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
public void setName(String name) { |
|||
this.name = name; |
|||
} |
|||
} |
Loading…
Reference in new issue