package com.xhpc.activity.enums;

public enum WorkOrderTypeMeasureEnum {

    SOFTWARE_UPGRADE(1, "自动升级"),
    RATEMODEL_SYNC(2, "校时校价"),
    REBOOT(3, "重启"),
    RATEMODEL_NEW(4, "下发新费率")
    ;

    private final Integer code;
    private final String name;


    WorkOrderTypeMeasureEnum(Integer code, String name){
        this.code = code;
        this.name = name;
    }

    //根据code获取name
    public static String getNameByCode(Integer code) {
        for (WorkOrderTypeMeasureEnum typeEnum : WorkOrderTypeMeasureEnum.values()) {
            if (typeEnum.code.equals(code)) {
                return typeEnum.name;
            }
        }
        return "";
    }

    //根据name获取code
    public static Integer getCodeByName(String name) {
        for (WorkOrderTypeMeasureEnum typeEnum : WorkOrderTypeMeasureEnum.values()) {
            //移除交办
            if (typeEnum.name.equals(name)) {
                return typeEnum.code;
            }
        }
        return null;
    }

    public Integer getCode() {

        return code;
    }

    public String getName() {

        return name;
    }
}
