UserIdentityEnum.java 545 B

123456789101112131415161718192021222324252627
  1. package com.qs.mp.common.enums;
  2. /**
  3. * 用户身份
  4. *
  5. * @author liugl
  6. * @Date 2022/03/01
  7. */
  8. public enum UserIdentityEnum {
  9. CHANNEL, // 代理渠道
  10. SALESITE, // 经销商
  11. USER, // 用户
  12. ADMIN // 管理后台
  13. ;
  14. public static boolean isChannel(UserIdentityEnum identity) {
  15. return identity == CHANNEL || identity == SALESITE;
  16. }
  17. public static UserIdentityEnum valueOf(int ordinal) {
  18. if (ordinal < 0 || ordinal >= values().length) {
  19. throw new IndexOutOfBoundsException("Invalid ordinal");
  20. }
  21. return values()[ordinal];
  22. }
  23. }