package com.vci.starter.web.enumpck;
|
|
|
/**
|
* 数据修改类型
|
* @author weidy
|
* @date 2019/10/10 4:23 PM
|
*/
|
public enum VciChangeDocumentTypeEnum {
|
/**
|
* 添加
|
*/
|
ADD,
|
/**
|
* 修改
|
*/
|
EDIT,
|
/**
|
* 删除
|
*/
|
DELETE,
|
|
/**
|
* 生命周期变化
|
*/
|
LCSTATUS,
|
|
/**
|
* 升版
|
*/
|
UPREVISION,
|
|
/**
|
* 提交流程
|
*/
|
SUBMIT,
|
|
/**
|
* 发布
|
*/
|
RELEASED,
|
/**
|
* 全部
|
*/
|
ALL;
|
|
/**
|
* 根据名称获取对应的枚举值
|
* @param text 名称
|
* @return 枚举值
|
*/
|
public static String getValueByText(String text){
|
if(text == null || text.trim().length() == 0){
|
return "";
|
}else{
|
if("删除".equalsIgnoreCase(text)){
|
return DELETE.name();
|
}else if("修改".equalsIgnoreCase(text)){
|
return EDIT.name();
|
}else if("生命周期变更".equalsIgnoreCase(text)){
|
return LCSTATUS.name();
|
}else if("升版".equalsIgnoreCase(text)){
|
return UPREVISION.name();
|
}else if("提交流程".equalsIgnoreCase(text)){
|
return SUBMIT.name();
|
}else if("发布".equalsIgnoreCase(text)){
|
return RELEASED.name();
|
}else if("全部".equalsIgnoreCase(text)){
|
return ALL.name();
|
}else{
|
return ADD.name();
|
}
|
}
|
}
|
|
/**
|
* 根据枚举值获取名称
|
* @param value 枚举值
|
* @return 名称
|
*/
|
public static String getTextByValue(String value){
|
VciChangeDocumentTypeEnum wenum = forValue(value);
|
if(wenum == null){
|
return "";
|
}
|
switch (wenum){
|
case DELETE:
|
return "删除";
|
case EDIT:
|
return "修改";
|
case LCSTATUS:
|
return "生命周期变更";
|
case UPREVISION:
|
return "升版";
|
case SUBMIT:
|
return "提交流程";
|
case RELEASED:
|
return "发布";
|
case ALL:
|
return "全部";
|
default:
|
return "添加";
|
}
|
}
|
|
/**
|
* 根据枚举值获取枚举对象
|
* @param value 枚举值
|
* @return 对应的枚举对象,不匹配的时候返回null
|
*/
|
public static VciChangeDocumentTypeEnum forValue(String value){
|
for(VciChangeDocumentTypeEnum wenum : VciChangeDocumentTypeEnum.values()){
|
if(wenum.name().equalsIgnoreCase(value)){
|
return wenum;
|
}
|
}
|
return null;
|
}
|
|
}
|