admin
2025-02-11 8cc47cfe4c6d6b48e62cf00f6cbd0951ec57c264
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.everyday.word.entity.user;
 
/**
 * @author hxh
 * @title: IdentityType
 * @description: 表示类型
 * @date 2025/2/11 10:40
 */
public enum IdentityType {
    // 手机号登录
    PHONE("phone"),
    // 微信登录
    WECHAT("wechat"),
    // QQ登录
    QQ("qq");
 
    private final String value;
 
    IdentityType(String value) {
        this.value = value;
    }
 
    public String getValue() {
        return value;
    }
    // 根据字符串值获取枚举
    public static IdentityType fromValue(String value) {
        for (IdentityType type : IdentityType.values()) {
            if (type.getValue().equals(value)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown identity type: " + value);
    }
}