设备类型管理
This commit is contained in:
@ -1,48 +0,0 @@
|
||||
package com.fuyuanshen.equipment.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* 用户类型枚举
|
||||
*
|
||||
* @author: 默苍璃
|
||||
* @date: 2025-06-1811:14
|
||||
*/
|
||||
public enum UserType {
|
||||
|
||||
APP(0, "APP"), MINI_PROGRAM(1, "小程序");
|
||||
|
||||
private final int value;
|
||||
private final String description;
|
||||
|
||||
UserType(int value, String description) {
|
||||
this.value = value;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据值获取对应的枚举
|
||||
*
|
||||
* @param value 枚举值
|
||||
* @return 对应的枚举对象
|
||||
*/
|
||||
public static UserType fromValue(int value) {
|
||||
for (UserType userType : values()) {
|
||||
if (userType.getValue() == value) {
|
||||
return userType;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Invalid user type value: " + value);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user