StudyStatusEnum.java 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package com.xjrsoft.common.enums;
  2. import java.util.HashMap;
  3. import java.util.Map;
  4. /**
  5. * @description: 就读方式stduy_status
  6. * @author: phoenix
  7. * @create: 2023/12/21 11:27
  8. * @Version 1.0
  9. */
  10. public enum StudyStatusEnum {
  11. /**
  12. * 走读
  13. * */
  14. AttendDaySchool("FB3001", "走读"),
  15. /**
  16. * 住校
  17. * */
  18. InResidence("FB3002", "住校"),
  19. /**
  20. * 借宿
  21. * */
  22. PutUpNight("FB3003", "借宿"),
  23. /**
  24. * 其他
  25. * */
  26. ElseStudyStatus("FB3004", "其他");
  27. final String code;
  28. final String value;
  29. private static final Map<String, String> lookup = new HashMap<>();
  30. static {
  31. for (StudyStatusEnum s : StudyStatusEnum.values()) {
  32. lookup.put(s.getCode(), s.getValue());
  33. }
  34. }
  35. public String getCode() {
  36. return this.code;
  37. }
  38. public String getValue() {
  39. return this.value;
  40. }
  41. StudyStatusEnum(final String code, final String message) {
  42. this.code = code;
  43. this.value = message;
  44. }
  45. public static String fromCode(String code) {
  46. return lookup.get(code);
  47. }
  48. public static String getCode(String value) {
  49. for (StudyStatusEnum item : values()) {
  50. if (item.getValue().equals(value)) {
  51. return item.getCode();
  52. }
  53. }
  54. return null;
  55. }
  56. }