package com.zfire.mall.manager.enums;


import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum StatusEnum {
    ON(true,"有效"),
    OFF(false,"无效");

    @JsonValue
    @EnumValue
    private final Boolean key;
    private final String value;


    public static StatusEnum findEnumByKey(String key) {
        StatusEnum[] values = StatusEnum.values();
        for (StatusEnum isEnum : values) {
            if (isEnum.getKey().equals(key)) {
                return isEnum;
            }
        }
        return null;
    }

}
