package cn.hnthyy.thmz.enums;

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

/**
 * 工作状态枚举
 */
public enum WorkingStatusEnum {
    WORKING(1, "在职"),
    UNPAID_LEAVE(2, "退休"),
    LEAVE(3, "调离"),
    RETIRE(4, "编码"),
    LIXIU(5, "离休"),
    CHUGUO(6, "出国"),
    LIUDONG(7, "流动"),
    CIZHI(8, "离职(辞职)"),
    CITUI(9, "离职(辞退)");
    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;
    }
}
