- git mv src/main/java/com/bestsch/bschclassmanage -> src/main/java/com/yunhai/bschclassmanage - 255 个 Java 文件的 package/import 同步替换为 com.yunhai.bschclassmanage - pom.xml 项目 groupId 设为 com.yunhai(与外部依赖 com.bestsch:bsch-* 无关,未改动) - IDE 缓存 workspace.xml 路径同步更新(外部依赖坐标 com.bestsch:bsch-* 保持不动)
87 lines
1.9 KiB
Java
87 lines
1.9 KiB
Java
package com.yunhai.bschclassmanage.enums;
|
|
|
|
import com.yunhai.bschclassmanage.model.vo.SelectIntVO;
|
|
import lombok.AllArgsConstructor;
|
|
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
|
|
@AllArgsConstructor
|
|
public enum TransferStatus
|
|
{
|
|
OUT(0,"转出"),
|
|
IN(1,"转入");
|
|
|
|
private Integer id;
|
|
private String 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<TransferStatus> list()
|
|
{
|
|
return new ArrayList<>(EnumSet.allOf(TransferStatus.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, TransferStatus> map()
|
|
{
|
|
return list().stream().collect(Collectors.toMap(TransferStatus::getId, QuestionType->QuestionType));
|
|
}
|
|
|
|
public static String nameById(int id) {
|
|
for (TransferStatus type : list()) {
|
|
if (type.getId() == id) return type.getName();
|
|
}
|
|
return null;
|
|
}
|
|
public static Integer getIdByName(String name) {
|
|
for (TransferStatus type : list()) {
|
|
if (type.getName().equals(name)) return type.getId();
|
|
}
|
|
return null;
|
|
}
|
|
public static TransferStatus getById(int id)
|
|
{
|
|
for (TransferStatus na : list())
|
|
{
|
|
if (na.getId() == id)
|
|
{
|
|
return na;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|