package com.vci.web.enumpck;
|
|
|
import com.vci.starter.web.annotation.VciEnum;
|
import com.vci.starter.web.enumpck.BaseEnum;
|
import com.vci.constant.EnumIdConstant;
|
|
/**
|
* 编码元素类型
|
* @author weidy
|
* @date 2020/3/28
|
*/
|
@VciEnum(name = EnumIdConstant.CODE_ELEMENT_TYPE,text = "编码元素类型",description = "包括常量,枚举映射,特殊映射,手动输入,流水号")
|
public enum OsCodeElementTypeEnum implements BaseEnum {
|
|
/**
|
* 手动输入
|
*/
|
INPUT("code_element_input","手动输入"),
|
|
/**
|
* 常量
|
*/
|
STATIC("code_element_static","常量"),
|
|
/**
|
* 日期
|
*/
|
DATE("code_element_date","日期"),
|
|
/**
|
* 属性
|
*/
|
FIELD("code_element_field","属性"),
|
|
/**
|
* 枚举属性映射
|
*/
|
ENUM("code_element_enum","枚举属性映射"),
|
|
/**
|
* 公式
|
*/
|
EXPRESSION("code_element_expression","公式"),
|
|
/**
|
* 流水号
|
*/
|
SERIAL("code_element_serial","流水号");
|
|
/**
|
* 枚举的值
|
*/
|
private String value;
|
|
/**
|
* 枚举显示文本
|
*/
|
private String text;
|
|
/**
|
* 获取枚举值
|
*
|
* @return 枚举值
|
*/
|
@Override
|
public String getValue() {
|
return value;
|
}
|
|
/**
|
* 设置枚举值
|
*
|
* @param value 枚举值
|
*/
|
public void setValue(String value) {
|
this.value = value;
|
}
|
|
/**
|
* 获取枚举显示文本
|
*
|
* @return 显示文本
|
*/
|
@Override
|
public String getText() {
|
return text;
|
}
|
|
/**
|
* 设置显示文本
|
*
|
* @param text 显示文本
|
*/
|
public void setText(String text) {
|
this.text = text;
|
}
|
|
/**
|
* 构造函数
|
*
|
* @param value 值
|
* @param text 显示文本
|
*/
|
private OsCodeElementTypeEnum(String value, String text) {
|
this.value = value;
|
this.text = text;
|
}
|
|
/**
|
* 根据名称获取对应的枚举值
|
*
|
* @param text 名称
|
* @return 枚举值
|
*/
|
public static String getValueByText(String text) {
|
for (OsCodeElementTypeEnum wenum : OsCodeElementTypeEnum.values()) {
|
if (wenum.getText().equalsIgnoreCase(text)) {
|
return wenum.getValue();
|
}
|
}
|
return "";
|
}
|
|
/**
|
* 根据枚举值获取名称
|
*
|
* @param value 枚举值
|
* @return 名称
|
*/
|
public static String getTextByValue(String value) {
|
for (OsCodeElementTypeEnum wenum : OsCodeElementTypeEnum.values()) {
|
if (wenum.getValue().equalsIgnoreCase(value)) {
|
return wenum.getText();
|
}
|
}
|
return "";
|
}
|
|
/**
|
* 根据枚举值获取枚举对象
|
*
|
* @param value 枚举值
|
* @return 枚举对象,不存在时候返回null
|
*/
|
public static OsCodeElementTypeEnum forValue(String value) {
|
for (OsCodeElementTypeEnum wenum : OsCodeElementTypeEnum.values()) {
|
if (wenum.getValue().equalsIgnoreCase(value)) {
|
return wenum;
|
}
|
}
|
return null;
|
}
|
}
|