package com.vci.starter.web.enumpck;
|
|
|
/**
|
* 任务调整类型
|
* @author weidy
|
* @date 2019/10/10 4:23 PM
|
*/
|
public enum VciTaskBusTypeEnum {
|
/**
|
* 添加
|
*/
|
ADD,
|
/**
|
* 修改
|
*/
|
EDIT,
|
/**
|
* 删除
|
*/
|
DELETE,
|
/**
|
* 冻结
|
*/
|
FREEZE,
|
/**
|
* 恢复
|
*/
|
RECOVER,
|
/**
|
* 完成
|
*/
|
FINISH,
|
/**
|
* 分解
|
*/
|
RESOLVE,
|
/**
|
* 全部
|
*/
|
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 FREEZE.name();
|
}else if("恢复".equalsIgnoreCase(text)){
|
return RECOVER.name();
|
}else if("完成".equalsIgnoreCase(text)){
|
return FINISH.name();
|
}else if("分解".equalsIgnoreCase(text)){
|
return RESOLVE.name();
|
}else if("全部".equalsIgnoreCase(text)){
|
return ALL.name();
|
}else{
|
return ADD.name();
|
}
|
}
|
}
|
|
/**
|
* 根据枚举值获取名称
|
* @param value 枚举值
|
* @return 名称
|
*/
|
public static String getTextByValue(String value){
|
VciTaskBusTypeEnum wenum = forValue(value);
|
if(wenum == null){
|
return "";
|
}
|
switch (wenum){
|
case DELETE:
|
return "删除";
|
case EDIT:
|
return "修改";
|
case FREEZE:
|
return "冻结";
|
case RECOVER:
|
return "恢复";
|
case FINISH:
|
return "完成";
|
case RESOLVE:
|
return "分解";
|
case ALL:
|
return "全部";
|
default:
|
return "添加";
|
}
|
}
|
|
/**
|
* 根据枚举值获取枚举对象
|
* @param value 枚举值
|
* @return 对应的枚举对象,不匹配的时候返回null
|
*/
|
public static VciTaskBusTypeEnum forValue(String value){
|
for(VciTaskBusTypeEnum wenum : VciTaskBusTypeEnum.values()){
|
if(wenum.name().equalsIgnoreCase(value)){
|
return wenum;
|
}
|
}
|
return null;
|
}
|
|
}
|