package cn.hnthyy.thmz.enums;

import java.util.Arrays;
import java.util.List;

/**
 * 工作状态枚举
 */
public enum  WorkingStatusEnum {

    WORKING(0,"在职"),
    UNPAID_LEAVE(1,"停薪留职"),
    LEAVE(2,"离职"),
    RETIRE(3,"退休");

    public Integer code;
    public String name;

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

    /**
     * 根据编码查询对应的类型
     * @param code
     * @return
     */
    public static WorkingStatusEnum getWorkingStatusByCode(String code){
        List<WorkingStatusEnum> reportTypeList= Arrays.asList(values());
        for (WorkingStatusEnum reportType:reportTypeList){
            if(reportType.code.equals(code)){
                return reportType;
            }
        }
        return null;
    }
}
