package enums; public enum UserBadgeEnum { //贡献者 三位数字,以1开头 FOUNDER(100, "创始人"), PRODUCT_MANAGER(101, "产品经理"), EXPERIENCE_DESIGNER(102, "体验设计师"), BACKEND(103, "服务端"), QUALITY_ASSURANCE(104, "测试工程师"), PROJECT_MANAGER(105, "项目管理"), ANDROID_FRONTEND(106, "Android前端"), IOS_FRONTEND(107, "IOS前端"), PRODUCT_OPERATION(108, "产品运营"); private Integer code; private String desc; UserBadgeEnum(Integer code, String desc) { this.code = code; this.desc = desc; } public static UserBadgeEnum getByCode(Integer code) { for (UserBadgeEnum item : UserBadgeEnum.values()) { if (item.getCode().equals(code)) { return item; } } return null; } public Integer getCode() { return code; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } }