package com.goafanti.order.enums;

import java.util.HashMap;
import java.util.Map;

public enum OrderDunProjectType {
	CGZH(1,"成果转化"),
	COMMON(2,"通用"),
	KJXM(3,"科技项目"),
	KJJR(4,"科技金融"),
	CS(5,"财税"),
	HY(6,"会员"),
	RJKF(7,"软件开发"),
	ZSCQ(8,"知识产权"),
	INVALID(99,"未知");
	
	private OrderDunProjectType(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	private static Map<Integer, OrderDunProjectType> status = new HashMap<Integer, OrderDunProjectType>();

	static {
		for (OrderDunProjectType value : OrderDunProjectType.values()) {
			status.put(value.getCode(), value);
		}
	}
	public static OrderDunProjectType getStatus(Integer code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return INVALID;
	}
	public static String getValueByCode(Integer code){
        for(OrderDunProjectType orderType:OrderDunProjectType.values()){
            if(code.equals(orderType.getCode())){
                return orderType.getDesc();
            }
        }
        return  INVALID.getDesc();
    }
	public static boolean containsType(Integer code) {
		return status.containsKey(code);
	}
	
	private Integer	code;
	private String	desc;
	public Integer getCode() {
		return code;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
}
