18 changed files with 327 additions and 36 deletions
@ -0,0 +1,57 @@ |
|||||
|
package com.epmet.enums; |
||||
|
|
||||
|
import org.springframework.util.StringUtils; |
||||
|
|
||||
|
public enum BuildingTypeEnums { |
||||
|
SPF("1","商品房"), |
||||
|
ZJF("2","自建房"), |
||||
|
BS("3","别墅"); |
||||
|
|
||||
|
private String key; |
||||
|
private String value; |
||||
|
|
||||
|
BuildingTypeEnums(String key, String value) { |
||||
|
this.key = key; |
||||
|
this.value=value; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public static String getTypeValue(Object key){ |
||||
|
if(null == key){ |
||||
|
return null; |
||||
|
} |
||||
|
BuildingTypeEnums buildingTypeEnums = getBuildType(String.valueOf(key)); |
||||
|
return buildingTypeEnums == null ? null : buildingTypeEnums.getValue(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public static String getKeyByValue(String value){ |
||||
|
if(StringUtils.isEmpty(value)){ |
||||
|
return ""; |
||||
|
} |
||||
|
for (BuildingTypeEnums e : BuildingTypeEnums.values()) { |
||||
|
if (e.getValue().equals(value)) { |
||||
|
return e.getKey(); |
||||
|
} |
||||
|
} |
||||
|
return ""; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private static BuildingTypeEnums getBuildType(String key) { |
||||
|
for (BuildingTypeEnums b :BuildingTypeEnums.values()) { |
||||
|
if (b.getKey().equals(key)) { |
||||
|
return b; |
||||
|
} |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
public String getValue() { |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
public String getKey() { |
||||
|
return key; |
||||
|
} |
||||
|
} |
@ -0,0 +1,59 @@ |
|||||
|
package com.epmet.enums; |
||||
|
|
||||
|
import org.springframework.util.StringUtils; |
||||
|
|
||||
|
public enum HousePurposeEnums { |
||||
|
ZZ("1","住宅"), |
||||
|
SY("2","商业"), |
||||
|
BG("3","办公"), |
||||
|
GY("4","工业"), |
||||
|
CC("5","仓储"), |
||||
|
SZHY("6","商住混用"), |
||||
|
QT("7","其他"); |
||||
|
|
||||
|
|
||||
|
private String key; |
||||
|
private String value; |
||||
|
|
||||
|
HousePurposeEnums(String key, String value) { |
||||
|
this.key = key; |
||||
|
this.value=value; |
||||
|
} |
||||
|
|
||||
|
public static String getKeyByValue(String value){ |
||||
|
if(StringUtils.isEmpty(value)){ |
||||
|
return ""; |
||||
|
} |
||||
|
for (HousePurposeEnums e : HousePurposeEnums.values()) { |
||||
|
if (e.getValue().equals(value)) { |
||||
|
return e.getKey(); |
||||
|
} |
||||
|
} |
||||
|
return ""; |
||||
|
} |
||||
|
|
||||
|
public static String getTypeValue(Object key){ |
||||
|
if(null == key){ |
||||
|
return null; |
||||
|
} |
||||
|
HousePurposeEnums buildingTypeEnums = getValueByKey(String.valueOf(key)); |
||||
|
return buildingTypeEnums == null ? null : buildingTypeEnums.getValue(); |
||||
|
} |
||||
|
|
||||
|
private static HousePurposeEnums getValueByKey(String key) { |
||||
|
for (HousePurposeEnums b : HousePurposeEnums.values()) { |
||||
|
if (b.getKey().equals(key)) { |
||||
|
return b; |
||||
|
} |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
public String getValue() { |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
public String getKey() { |
||||
|
return key; |
||||
|
} |
||||
|
} |
@ -0,0 +1,58 @@ |
|||||
|
package com.epmet.enums; |
||||
|
|
||||
|
import org.springframework.util.StringUtils; |
||||
|
|
||||
|
public enum HouseRentFlagEnums { |
||||
|
YES(1,"是"), |
||||
|
NO(0,"否"); |
||||
|
|
||||
|
|
||||
|
|
||||
|
private Integer code; |
||||
|
private String name; |
||||
|
|
||||
|
|
||||
|
HouseRentFlagEnums(Integer code, String name) { |
||||
|
this.code = code; |
||||
|
this.name=name; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public static String getTypeValue(Object code){ |
||||
|
if(code == null){ |
||||
|
return null; |
||||
|
} |
||||
|
HouseRentFlagEnums houseRentFlagEnums = getByKey(Integer.parseInt(code.toString())); |
||||
|
return houseRentFlagEnums == null ? null : houseRentFlagEnums.getName(); |
||||
|
} |
||||
|
|
||||
|
private static HouseRentFlagEnums getByKey(Integer code) { |
||||
|
for (HouseRentFlagEnums e : HouseRentFlagEnums.values()) { |
||||
|
if (e.getCode().equals(code)) { |
||||
|
return e; |
||||
|
} |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
public static Integer getCodeByName(String name){ |
||||
|
if(StringUtils.isEmpty(name)){ |
||||
|
return 0; |
||||
|
} |
||||
|
for (HouseRentFlagEnums e : HouseRentFlagEnums.values()) { |
||||
|
if (e.getName().equals(name)) { |
||||
|
return e.getCode(); |
||||
|
} |
||||
|
} |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public Integer getCode() { |
||||
|
return code; |
||||
|
} |
||||
|
|
||||
|
public String getName() { |
||||
|
return name; |
||||
|
} |
||||
|
} |
@ -0,0 +1,54 @@ |
|||||
|
package com.epmet.enums; |
||||
|
|
||||
|
import org.springframework.util.StringUtils; |
||||
|
|
||||
|
public enum HouseTypeEnums { |
||||
|
SPF("1","楼房"), |
||||
|
ZJF("2","平房"), |
||||
|
BS("3","别墅"); |
||||
|
|
||||
|
private String key; |
||||
|
private String value; |
||||
|
|
||||
|
HouseTypeEnums(String key, String value) { |
||||
|
this.key = key; |
||||
|
this.value=value; |
||||
|
} |
||||
|
|
||||
|
public static String getKeyByValue(String value){ |
||||
|
if(StringUtils.isEmpty(value)){ |
||||
|
return ""; |
||||
|
} |
||||
|
for (HouseTypeEnums e : HouseTypeEnums.values()) { |
||||
|
if (e.getValue().equals(value)) { |
||||
|
return e.getKey(); |
||||
|
} |
||||
|
} |
||||
|
return ""; |
||||
|
} |
||||
|
|
||||
|
public static String getTypeValue(Object key){ |
||||
|
if(null == key){ |
||||
|
return null; |
||||
|
} |
||||
|
HouseTypeEnums buildingTypeEnums = getByKey(String.valueOf(key)); |
||||
|
return buildingTypeEnums == null ? null : buildingTypeEnums.getValue(); |
||||
|
} |
||||
|
|
||||
|
private static HouseTypeEnums getByKey(String key) { |
||||
|
for (HouseTypeEnums b : HouseTypeEnums.values()) { |
||||
|
if (b.getKey().equals(key)) { |
||||
|
return b; |
||||
|
} |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
public String getValue() { |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
public String getKey() { |
||||
|
return key; |
||||
|
} |
||||
|
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue