package com.enums;

public enum SortEnum {
	TIME_ASC("t1.start_time asc","按时间升序"),
	TIME_DEAC("t1.start_time desc","按时间降序"),
	USRR_NAME_ASC("t1.create_name asc","按用户名升序"),
	USER_NAME_DESC("t1.create_name desc","按用户名降序"),
    OPER_ASC(" CONVERT(t1.oper USING gbk)COLLATE gbk_chinese_ci asc","按操作类型升序"),
    OPER_DESC(" CONVERT(t1.oper USING gbk)COLLATE gbk_chinese_ci desc","按操作类型降序");
	private  String  code;
	
	private  String  name;

	private SortEnum(String code, String name) {
		this.code = code;
		this.name = name;
	}
	
	public static String  getNameByCode(String code){
		if(code == null){
			return "";
		}
		for(SortEnum enums : SortEnum.values()){
			if(code.equals(enums.getCode())){
				return  enums.getName();
			}
		}
		return "";
	}
	
	public static String  getCodeByName(String name){
		if(name == null){
			return "";
		}
		for(SortEnum enums : SortEnum.values()){
			if(name.equals(enums.getName())){
				return  enums.code;
			}
		}
		return "";
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	

	
}
