package com.mortals.xhx.common.code;

import java.util.LinkedHashMap;
import java.util.Map;

public enum TaskInterimExcuteStatusEnum{
    /** 未启用 */
    UNUSE(0, "未启用"),
    /** 立即执行并保留 */
    IMMEDIATE_EXECUTION(1, "立即执行并保留"),
    /** 立即执行并删除 */
    IMMEDIATE_EXECUTION_BEFORE_DELETE(2, "立即执行并删除");
    
    private int value;
    private String desc;
    

    TaskInterimExcuteStatusEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
        
    }

    
    public int getValue() {
        return this.value;
    }

    public String getDesc() {
        return desc;
    }

	public static TaskInterimExcuteStatusEnum getByValue(int value) {
        for (TaskInterimExcuteStatusEnum taskInterimExcuteStatus : TaskInterimExcuteStatusEnum.values()) {
            if (taskInterimExcuteStatus.getValue() == value) {
                return taskInterimExcuteStatus;
            }
        }
        return null;
    }
	/**
	 * 获取Map集合
	 * @param eItem 不包含项
	 * @return
	 */
	public static Map<String,String> getEnumMap(int... eItem) {
		Map<String,String> resultMap= new LinkedHashMap<String,String>();
		for (TaskInterimExcuteStatusEnum item : TaskInterimExcuteStatusEnum.values()) {
			try{
				boolean hasE = false;
				for (int e : eItem){
					if(item.getValue()==e){
						hasE = true;
						break;
					}
				}
				if(!hasE){
					resultMap.put(item.getValue()+"", item.getDesc());
				}
			}catch(Exception ex){
			}
		}
		return resultMap;
	}
}
