package cn.superdesk.uniorder.common.enums.common;

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

/**
 * @Description: Java类作用描述
 * @Author: linjinyu
 * @CreateDate: 2021/6/10 上午11:46
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/6/10 上午11:46
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum CommonOrderGoodsUnitEnum {

	项(0, "项"),

	;

	private Integer key;
	private String  desc;

	CommonOrderGoodsUnitEnum(Integer key, String desc) {
		this.key = key;
		this.desc = desc;
	}

	public Integer getKey() {
		return key;
	}

	public String getDesc() {
		return desc;
	}

	public static String getDesc(Integer key) {
		for (CommonOrderGoodsUnitEnum c : CommonOrderGoodsUnitEnum.values()) {
			if (c.key.equals(key)) {
				return c.getDesc();
			}
		}
		return null;
	}

	private static final Map<Integer, CommonOrderGoodsUnitEnum> LOOKUP = new HashMap<>();

	static {
		for (CommonOrderGoodsUnitEnum s : EnumSet.allOf(CommonOrderGoodsUnitEnum.class)) {
			LOOKUP.put(s.getKey(), s);
		}
	}

	public static CommonOrderGoodsUnitEnum get(Integer key) {
		return LOOKUP.get(key);
	}
}
