KeyAuthEnum.java 890 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package com.care.common.enums;
  2. import cn.hutool.core.util.StrUtil;
  3. /**
  4. * @Author:java
  5. * @Date: 2021/05/27
  6. */
  7. public enum KeyAuthEnum {
  8. /**
  9. * 钥匙授权
  10. */
  11. TODO("0","申请授权"),
  12. AUTHED("1","已授权"),
  13. RETURN("2","归还钥匙");
  14. private String value;
  15. private String name;
  16. KeyAuthEnum(String value, String name) {
  17. this.value = value;
  18. this.name = name;
  19. }
  20. public String getValue() {
  21. return value;
  22. }
  23. public static String getCodeToName(String code){
  24. if (StrUtil.isEmpty(code)){
  25. return null;
  26. }
  27. if (TODO.getValue().equals(code)){
  28. return TODO.name;
  29. }else if (AUTHED.getValue().equals(code)){
  30. return AUTHED.name;
  31. }else if (RETURN.getValue().equals(code)){
  32. return RETURN.name;
  33. }
  34. return null;
  35. }
  36. }