package com.prolog.rdc.tms.constant.enums;

import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;

/**
 * 业务类型枚举
 * @author hongbo.pan
 * @date 2023/4/24
 */
@AllArgsConstructor
@Getter
public enum BusinessTypeEnum {

    INCOME(10, "收入"),
    PAY(20, "支出"),
    ;

    private static Map<Integer, BusinessTypeEnum> enumMap = Maps.newHashMap();
    private Integer code;
    private String desc;

    static {
        for(BusinessTypeEnum as : BusinessTypeEnum.values()) {
            enumMap.put(as.code, as);
        }
    }

    public static BusinessTypeEnum getByCode(Integer code) {
        return  enumMap.get(code);
    }

}
