StatusEnum.java 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package com.fuint.common.enums;
  2. import com.fuint.common.dto.ParamDto;
  3. import java.util.Arrays;
  4. import java.util.List;
  5. import java.util.stream.Collectors;
  6. /**
  7. * 通用状态枚举
  8. *
  9. * Created by FSQ
  10. * CopyRight https://www.fuint.cn
  11. */
  12. public enum StatusEnum {
  13. ENABLED("A", "启用"),
  14. EXPIRED("C", "过期"),
  15. DISABLE("D", "删除"),
  16. FORBIDDEN("N", "禁用"),
  17. UnAudited("U", "待审核");
  18. private String key;
  19. private String value;
  20. StatusEnum(String key, String value) {
  21. this.key = key;
  22. this.value = value;
  23. }
  24. public String getKey() {
  25. return key;
  26. }
  27. public void setKey(String key) {
  28. this.key = key;
  29. }
  30. public String getValue() {
  31. return value;
  32. }
  33. public void setValue(String value) {
  34. this.value = value;
  35. }
  36. public static List<ParamDto> getStatusList() {
  37. return Arrays.stream(StatusEnum.values())
  38. .map(status -> new ParamDto(status.getKey(), status.getValue(), status.getValue()))
  39. .collect(Collectors.toList());
  40. }
  41. }