package com.ruoyi.system.enums;

import com.ruoyi.common.enums.IIntegerEnum;

import java.util.Objects;

/**
 * @author 序号前缀
 */
public enum SequencePrefixEnum implements IIntegerEnum<String> {

    PRE_ORDER("P", "订单号"),
    PRE_USER("U", "用户编号"),
    ;

    private String code;
    private String msg;

    SequencePrefixEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static SequencePrefixEnum getByCode(int code, SequencePrefixEnum[] values) {
        for (SequencePrefixEnum value : values) {
            if (Objects.equals(code, value.getCode())) {
                return value;
            }
        }
        return null;
    }

}
