package com.nova.sankuai.domain.enums; import io.swagger.annotations.ApiModel; import org.apache.commons.lang.StringUtils; /** * @author weikangdi * 产品属性 */ @ApiModel(value = "机构信息-产品属性枚举") public enum ProductAttributesEnum { HOUSE(0, "房子"), CAR(1, "汽车"), PROVIDENT_FUND(2, "公积金"), BUSINESS_INSURANCE(3, "商业保险"), SOCIAL_SECURITY(4, "社保"), SESAME(5, "芝麻分"), CREDIT_CARD(6, "信用卡"); private Integer code; private String value; ProductAttributesEnum(int code, String value) { this.code = code; this.value = value; } public static String value(int code) { for (ProductAttributesEnum m : ProductAttributesEnum.values()) { if (m.getCode() == code) { 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.parseInt(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; } }