6 changed files with 133 additions and 5 deletions
@ -0,0 +1,69 @@ |
|||||
|
package com.easy.admin.common.enums; |
||||
|
|
||||
|
/** |
||||
|
* 上级指导处室 枚举 |
||||
|
* 编码 -> 处室名称 映射 |
||||
|
*/ |
||||
|
public enum SuperLeaderEnum { |
||||
|
|
||||
|
YI_ZHENG("1", "医政处"), |
||||
|
FU_YOU("2", "妇幼处"), |
||||
|
KE_JIAO("3", "科教处"), |
||||
|
TI_GAI("4", "体改处"), |
||||
|
GUI_XIN("5", "规信处"), |
||||
|
ZHONG_YI("6", "中医处"), |
||||
|
CAI_SHEN("7", "财审处"), |
||||
|
JI_GUAN_DANG_WEI("8", "机关党委"), |
||||
|
ZU_ZHI_REN_SHI("9", "组织人事处"), |
||||
|
OTHER("10", "其他"); |
||||
|
|
||||
|
private final String code; |
||||
|
private final String name; |
||||
|
|
||||
|
SuperLeaderEnum(String code, String name) { |
||||
|
this.code = code; |
||||
|
this.name = name; |
||||
|
} |
||||
|
|
||||
|
public String getCode() { |
||||
|
return code; |
||||
|
} |
||||
|
|
||||
|
public String getName() { |
||||
|
return name; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据编码获取处室名称 |
||||
|
* @param code 处室编码 |
||||
|
* @return 对应的处室名称,未找到返回 "未知处室" |
||||
|
*/ |
||||
|
public static String getNameByCode(String code) { |
||||
|
for (SuperLeaderEnum item : values()) { |
||||
|
if (item.code.equals(code)) { |
||||
|
return item.name; |
||||
|
} |
||||
|
} |
||||
|
return "未知处室"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 判断编码是否有效 |
||||
|
* @param code 待验证的编码 |
||||
|
* @return 是否有效 |
||||
|
*/ |
||||
|
public static boolean isValid(String code) { |
||||
|
if (code == null) return false; |
||||
|
for (SuperLeaderEnum item : values()) { |
||||
|
if (item.code.equals(code)) { |
||||
|
return true; |
||||
|
} |
||||
|
} |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
return name; // 例如:SuperLeaderEnum.YI_ZHENG.toString() 返回 "医政处"
|
||||
|
} |
||||
|
} |
Loading…
Reference in new issue