package com.hfkj.sysenum;

import java.util.Objects;

/**
 * 登录方式
 * @className: LoginType
 * @author: HuRui
 * @date: 2022/10/20
 **/
public enum UserLoginType {
    PWD("PWD", "密码登录"),
    SMS("SMS", "短信登录"),
    WECHAT_MA_PHONE("WECHAT_MA_PHONE", "微信小程序手机号"),
    WECHAT_MA_OPENID("WECHAT_MA_OPENID", "微信小程序openId"),
    WECHAT_MP_OPENID("WECHAT_MP_OPENID", "微信公众号openId"),
    V_FAMILY_OPENID("V_FAMILY_OPENID", "V家园openId"),
    GZ_GOV_OPENID("GZ_GOV_OPENID", "省自机关openId"),
            ;

    private String code;

    private String name;

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

    /**
     * 根据类型查询数据
     * @param code
     * @return
     */
    public static UserLoginType getDataByType(String code) {
        for (UserLoginType 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;
    }
}
