feat(auth): 添加 UserType 枚举常量,区分 ADMIN 和 MEMBER 用户类型
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
package cn.novalon.gym.manage.common.constants;
|
||||
|
||||
/**
|
||||
* 用户类型枚举
|
||||
* 用于区分后台管理用户和前台会员用户
|
||||
*/
|
||||
public enum UserType {
|
||||
ADMIN,
|
||||
MEMBER;
|
||||
|
||||
public static UserType fromString(String value) {
|
||||
if (value == null) {
|
||||
throw new IllegalArgumentException("userType 不能为空");
|
||||
}
|
||||
for (UserType type : values()) {
|
||||
if (type.name().equalsIgnoreCase(value)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("未知的用户类型: " + value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user