package org.springblade.enums;

public enum OrderStatusEnum {
	/**
	 * 工单创建
	 */
	STATUS_CREATE("1", "新工单"),

	/**
	 * 工单接单
	 */
	STATUS_CONFIRM("2", "已接单"),

	/**
	 * 工单处理
	 */
	STATUS_PROCESS("3", "工单处理"),
	/**
	 * 费用待审批
	 */
	STATUS_COSTS_PENDING_APPROVE("4", "费用待审批"),
	/**
	 * 工单费用审批
	 */
	STATUS_COSTS_APPROVE("5", "工单费用审批"),
	/**
	 * 工单关闭待审批
	 */
	STATUS_CLOSE_PENDING_APPROVE("6", "工单关闭待审批"),
	/**
	 * 工单关闭
	 */
	STATUS_CLOSE("7", "工单关闭"),
	/**
	 * 工单取消
	 */
	STATUS_CANCEL("8", "工单取消");

	private String code;

	private String name;

	private OrderStatusEnum(String 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(String code) {
		for (OrderStatusEnum type : OrderStatusEnum.values()) {
			if (type.code.equals(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 OrderStatusEnum getEnumByCode(String code) {
		for (OrderStatusEnum type : OrderStatusEnum.values()) {
			if (type.code.equals(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 OrderStatusEnum getEnumByName(String name) {
		for (OrderStatusEnum type : OrderStatusEnum.values()) {
			if (type.name.equals(name)) {
				return type;
			}
		}
		return null;
	}


	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;
	}
}
