package com.goafanti.report.enums;

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

public enum OrderBy {
	DESC("desc", "降序"), ASC("asc", "升序");

	private OrderBy(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	private static Map<String, OrderBy> status = new HashMap<String, OrderBy>();

	static {
		for (OrderBy value : OrderBy.values()) {
			status.put(value.getCode(), value);
		}
	}

	public static OrderBy getField(String code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return DESC;
	}

	public static boolean containsType(String code) {
		return status.containsKey(code);
	}

	private String	code;
	private String	desc;

	public String getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}
}
