package com.nova.sankuai.domain.enums; import io.swagger.annotations.ApiModel; import org.apache.commons.lang.StringUtils; /** * @author weikangdi * 职业信息 */ @ApiModel(value = "职业信息枚举") public enum ProfessionInfoEnum { OFFICE_WORKER(0, "上班族"), FREELANCE(1, "自由职业"), BUSINESS_OWNERS(2, "企业主"), SELF_EMPLOYED(3, "个体户"), CIVIL_SERVANTS(4, "公务员"); private Integer code; private String value; ProfessionInfoEnum(int code, String value) { this.code = code; this.value = value; } public static String value(Integer code) { if (code != null) { for (ProfessionInfoEnum m : ProfessionInfoEnum.values()) { if (m.getCode() == code.intValue()) { return m.getValue(); } } } return null; } public static String getValues(String ids) { String resultStr = ""; String[] split = ids.split(","); for (String code : split) { String value = value(Integer.valueOf(code)); if (StringUtils.isNotBlank(value)) { resultStr = StringUtils.isNotBlank(resultStr) ? resultStr + "," + value : resultStr + value; } } return resultStr; } public Integer getCode() { return code; } public void setCode(Integer code) { this.code = code; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } }