package com.hai.enum_type;

import java.util.Objects;

/**
 * redis文件夹
 * @className: RedisFileFolder
 * @author: HuRui
 * @date: 2022/10/20
 **/
public enum RedisFileFolder {
    SMS_CODE("SMS_CODE:", "短信验证码"),
    USER("USER:", "用户信息"),
    ADMIN("ADMIN:", "管理信息"),
    ;

    private String code;

    private String name;

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

    /**
     * 根据类型查询数据
     * @param code
     * @return
     */
    public static RedisFileFolder getDataByType(String code) {
        for (RedisFileFolder ele : values()) {
            if(Objects.equals(code,ele.getCode())) return ele;
        }
        return null;
    }

    public String getCode() {
        return code;
    }

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

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
