parent
6cf0ebaef3
commit
cec0a7e58d
@ -1,13 +1,50 @@
|
||||
package cn.teammodel.common;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 五育枚举
|
||||
* @author winter
|
||||
* @create 2023-12-14 12:19
|
||||
*/
|
||||
public interface FiveEducations {
|
||||
String MORAL = "美德";
|
||||
String INTELLECTUAL = "美智";
|
||||
String PHYSICAL = "体育";
|
||||
String AESTHETIC = "美艺";
|
||||
String LABOUR = "劳动";
|
||||
public enum FiveEducations {
|
||||
VIRTUE("virtue", "德育"),
|
||||
INTELLIGENCE("intelligence","智育"),
|
||||
SPORTS("sports", "体育"),
|
||||
ART("art", "美育"),
|
||||
LABOUR("labour", "劳育");
|
||||
|
||||
private final String code;
|
||||
private final String name;
|
||||
|
||||
public static List<String> codes() {
|
||||
return Arrays.stream(values()).map(FiveEducations::getCode).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 name 获取 code
|
||||
*/
|
||||
public static String getCodeByName(String name) {
|
||||
FiveEducations fiveEducation = Arrays.stream(values()).filter(item -> item.getName().equals(name)).findFirst().orElse(null);
|
||||
String res = null;
|
||||
if (fiveEducation != null) {
|
||||
res = fiveEducation.getCode();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
FiveEducations(String code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue