17 changed files with 360 additions and 81 deletions
@ -0,0 +1,65 @@ |
|||
package com.zdxt.enforcementcode.common.commonenum; |
|||
|
|||
/** |
|||
* 来源类型枚举定义 |
|||
* @author Lion Li |
|||
*/ |
|||
public enum MsgSourceTypeEnums { |
|||
|
|||
/** |
|||
* 普法消息 |
|||
*/ |
|||
ORIGINAL(1, "普法消息"); |
|||
|
|||
private Integer key; |
|||
private String value; |
|||
|
|||
MsgSourceTypeEnums(Integer key, String value) { |
|||
this.key = key; |
|||
this.value = value; |
|||
} |
|||
|
|||
public String getValue() { |
|||
return value; |
|||
} |
|||
|
|||
public Integer getKey() { |
|||
return key; |
|||
} |
|||
|
|||
/** |
|||
* 根据key获取value |
|||
* @param key 来源类型key |
|||
* @return 来源类型描述 |
|||
*/ |
|||
public static String getValueByKey(Integer key) { |
|||
if (key == null) { |
|||
return ""; |
|||
} |
|||
MsgSourceTypeEnums[] enums = MsgSourceTypeEnums.values(); |
|||
for (MsgSourceTypeEnums sourceType : enums) { |
|||
if (sourceType.getKey().equals(key)) { |
|||
return sourceType.getValue(); |
|||
} |
|||
} |
|||
return ""; |
|||
} |
|||
|
|||
/** |
|||
* 根据value获取key |
|||
* @param value 来源类型描述 |
|||
* @return 来源类型key |
|||
*/ |
|||
public static Integer getKeyByValue(String value) { |
|||
if (value == null || value.isEmpty()) { |
|||
return null; |
|||
} |
|||
MsgSourceTypeEnums[] enums = MsgSourceTypeEnums.values(); |
|||
for (MsgSourceTypeEnums sourceType : enums) { |
|||
if (sourceType.getValue().equals(value)) { |
|||
return sourceType.getKey(); |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
} |
|||
@ -0,0 +1,75 @@ |
|||
package com.zdxt.enforcementcode.common.commonenum; |
|||
|
|||
/** |
|||
* 平台类型枚举定义 |
|||
* @author Lion Li |
|||
*/ |
|||
public enum PlatformTypeEnums { |
|||
|
|||
/** |
|||
* 监督端 |
|||
*/ |
|||
SUPERVISION(1, "监督端"), |
|||
|
|||
/** |
|||
* 执法端 |
|||
*/ |
|||
ENFORCEMENT(2, "执法端"), |
|||
|
|||
/** |
|||
* 企业端 |
|||
*/ |
|||
ENTERPRISE(3, "企业端"); |
|||
|
|||
private Integer key; |
|||
private String value; |
|||
|
|||
PlatformTypeEnums(Integer key, String value) { |
|||
this.key = key; |
|||
this.value = value; |
|||
} |
|||
|
|||
public String getValue() { |
|||
return value; |
|||
} |
|||
|
|||
public Integer getKey() { |
|||
return key; |
|||
} |
|||
|
|||
/** |
|||
* 根据key获取value |
|||
* @param key 平台类型key |
|||
* @return 平台类型描述 |
|||
*/ |
|||
public static String getValueByKey(Integer key) { |
|||
if (key == null) { |
|||
return ""; |
|||
} |
|||
PlatformTypeEnums[] enums = PlatformTypeEnums.values(); |
|||
for (PlatformTypeEnums platformType : enums) { |
|||
if (platformType.getKey()== key) { |
|||
return platformType.getValue(); |
|||
} |
|||
} |
|||
return ""; |
|||
} |
|||
|
|||
/** |
|||
* 根据value获取key |
|||
* @param value 平台类型描述 |
|||
* @return 平台类型key |
|||
*/ |
|||
public static Integer getKeyByValue(String value) { |
|||
if (value == null || value.isEmpty()) { |
|||
return null; |
|||
} |
|||
PlatformTypeEnums[] enums = PlatformTypeEnums.values(); |
|||
for (PlatformTypeEnums platformType : enums) { |
|||
if (platformType.getValue().equals(value)) { |
|||
return platformType.getKey(); |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
} |
|||
Loading…
Reference in new issue