package cn.hnthyy.thmz.enums;

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

/**
 * 号段
 */
public enum WorkTimeEnum {
    AM("a","上午"),
    NOON("n","中午"),
    PM("p","下午"),
    DAY("d","全天"),
    NIGHT("e","晚班"),
    LATE_AT_NIGHT("l","夜班");

    public String code;
    public String name;

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

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