100 lines
2.3 KiB
Java
100 lines
2.3 KiB
Java
package com.yunhai.bschclassmanage.enums;
|
|
|
|
import com.yunhai.bschclassmanage.model.vo.SelectIntVO;
|
|
import lombok.Getter;
|
|
import lombok.NoArgsConstructor;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.EnumSet;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
|
|
@Getter
|
|
@NoArgsConstructor
|
|
public enum StuAbnormalStatus
|
|
{
|
|
NORMAL(0,"正常"),
|
|
SUSPEND_SCHOOLING(1,"休学"),
|
|
GO_ABROAD(2,"出国"),
|
|
STUDY_ABROAD(3,"留学"),
|
|
RESUME_SCHOOLING(4,"复学"),
|
|
STOP_SCHOOLING(5,"停学"),
|
|
VOLUNTARY_RETREAT_SCHOOLING(6,"自愿退学"),
|
|
VOLUNTARY_REPEAT_GRADE(7,"自愿留级"),
|
|
VOLUNTARY_DROP_GRADE(8,"自愿降级"),
|
|
ELSE(99,"其他");
|
|
|
|
|
|
private int id;
|
|
private String name;
|
|
|
|
StuAbnormalStatus(int id, String name)
|
|
{
|
|
this.id = id;
|
|
this.name = name;
|
|
}
|
|
|
|
public int getId()
|
|
{
|
|
return id;
|
|
}
|
|
|
|
public void setId(int id)
|
|
{
|
|
this.id = id;
|
|
}
|
|
|
|
public String getName()
|
|
{
|
|
return name;
|
|
}
|
|
|
|
public void setName(String name)
|
|
{
|
|
this.name = name;
|
|
}
|
|
|
|
public static List<StuAbnormalStatus> list()
|
|
{
|
|
return new ArrayList<>(EnumSet.allOf(StuAbnormalStatus.class));
|
|
}
|
|
|
|
public static List<SelectIntVO> select() {
|
|
List<SelectIntVO> list= list().stream()
|
|
.map(type -> new SelectIntVO(type.getId(), type.getName()))
|
|
.collect(Collectors.toList());
|
|
return new ArrayList<>(list);
|
|
}
|
|
|
|
public static Map<Integer, StuAbnormalStatus> map()
|
|
{
|
|
return list().stream().collect(Collectors.toMap(StuAbnormalStatus::getId, QuestionType->QuestionType));
|
|
}
|
|
|
|
public static String nameById(int id) {
|
|
for (StuAbnormalStatus type : list()) {
|
|
if (type.getId() == id) return type.getName();
|
|
}
|
|
return null;
|
|
}
|
|
public static Integer getIdByName(String name) {
|
|
for (StuAbnormalStatus type : list()) {
|
|
if (type.getName().equals(name)) return type.getId();
|
|
}
|
|
return null;
|
|
}
|
|
public static StuAbnormalStatus getById(int id)
|
|
{
|
|
for (StuAbnormalStatus na : list())
|
|
{
|
|
if (na.getId() == id)
|
|
{
|
|
return na;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|