package com.cool.store.enums;

/**
 * 费用单类型枚举
 */
public enum ExpenseSheetTypeEnum {

    EXPENSE_SHEET(1, "费用单"),
    ADJUSTMENT_SHEET(2, "调整单");

    private final Integer code;
    private final String desc;

    ExpenseSheetTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 根据code获取枚举
     */
    public static ExpenseSheetTypeEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (ExpenseSheetTypeEnum typeEnum : values()) {
            if (typeEnum.getCode().equals(code)) {
                return typeEnum;
            }
        }
        return null;
    }
}
