package com.enums;

/**
 * @ClassName LogEnum
 * @Description  日志枚举
 * @Author zhangyanwei
 * @Date 2020/11/24 16:11
 * @Version 1.0
 **/
public enum LogEnum {
	lever("lever","级别为"),
	time("start_time","操作时间:"),
	sort("sort","功能排序"),
	oper("oper","功能类别"),
	ip("ip","ip"),
	sercher("sercher","查询"),
	logbak("logbak","日志备份"),
	logstore("logstore","日志恢复");
	private String code;
	private String decription;

	public String getCode() {
		return code;
	}

	private LogEnum(String code, String decription) {
		this.code = code;
		this.decription = decription;
	}

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

	public String getDecription() {
		return decription;
	}

	public void setDecription(String decription) {
		this.decription = decription;
	}
	
	public static String  getNameByCode(String code){
		if(code == null){
			return "";
		}
		for(LogEnum enums : LogEnum.values()){
			if(code.equals(enums.getCode())){
				return  enums.getDecription();
			}
		}
		return "";
	}
	
	public static String  getCodeByName(String name){
		if(name == null){
			return "";
		}
		for(LogEnum enums : LogEnum.values()){
			if(name.equals(enums.getDecription())){
				return  enums.code;
			}
		}
		return "";
	}
}
