枚举类de实体类
/**
* Description:
*
* @Author xy
* @data Created on 2022/5/4
*/
public enum BoardStatisticEnum {
/**
* 1.服务个数
*/
SERVICE_COUNT(1, "服务个数"),
/**
* 2.申报次数
*/
COMMIT_COUNT(2, "申报次数"),
/**
* 3.任务工作数
*/
TASK_OBJ_COUNT(3, "任务工作数");
public static BoardStatisticEnum getBoardStatisticEnum(Integer type) {
for (BoardStatisticEnum typeEnum : values()) {
if (typeEnum.type.equals(type)) {
return typeEnum;
}
}
return null;
}
private Integer type;
private String des;
BoardStatisticEnum(Integer type, String des) {
this.type = type;
this.des = des;
}
public Integer getType() {
return type;
}
public String getDes() {
return des;
}
}
用法
Integer type1 = getBoardStatisticEnum(1).getType();
Integer type2 = SERVICE_COUNT.getType();