package org.springblade.enums;

public enum InspectionStatusEnum {
	/**
	 * 待巡检
	 */
	STATUS_TODO(0, "待巡检"),

	/**
	 * 已巡检
	 */
	STATUS_REPORT(1, "已巡检"),

	/**
	 * 待完结审批
	 */
	STATUS_CLOSE_APPROVE(2, "待完结审批"),

	/**
	 * 完结已审批
	 */
	STATUS_APPROVED(3, "完结已审批"),

	/**
	 * 退回
	 */
	STATUS_BACK(4, "退回");



	private int code;

	private String name;

	private InspectionStatusEnum(int code, String name) {
		this.code = code;
		this.name = name;
	}

	/**
	 * Function:根据code来获取对应的name
	 * Author: Admin
	 * Date:2021/6/26
	 * @param code
	 * @return java.lang.String
	 * @throws Exception
	 */
	public static String getName(int code) {
		for (InspectionStatusEnum type : InspectionStatusEnum.values()) {
			if (type.code == code) {
				return type.name;
			}
		}
		return "";
	}

	/**
	 * Function:根据code来获取对应的枚举常量
	 * Author: Admin
	 * Date:2021/6/26
	 * @param code
	 * @return com.zhgzjg.web.enums.DeleteFlag
	 * @throws Exception
	 */
	public static InspectionStatusEnum getEnumByCode(int code) {
		for (InspectionStatusEnum type : InspectionStatusEnum.values()) {
			if (type.code == code) {
				return type;
			}
		}
		return null;
	}


	/**
	 * Function:根据name来获取对应的枚举常量
	 * Author: Admin
	 * Date:2021/6/26
	 * @param name
	 * @return com.zhgzjg.web.enums.DeleteFlag
	 * @throws Exception
	 */
	public static InspectionStatusEnum getEnumByName(String name) {
		for (InspectionStatusEnum type : InspectionStatusEnum.values()) {
			if (type.name.equals(name)) {
				return type;
			}
		}
		return null;
	}


	public int getCode() {
		return code;
	}

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

	public String getName() {
		return name;
	}

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