package cn.iocoder.yudao.module.crm.enums.salesTarget; import cn.iocoder.yudao.framework.common.core.ArrayValuable; import lombok.Getter; import lombok.RequiredArgsConstructor; import java.util.Arrays; /** * 销售目标的目标维度枚举 * * @author 超级管理员 */ @RequiredArgsConstructor @Getter public enum CrmSalesTargetDimensionEnum implements ArrayValuable { USER(1, "个人"), DEPT(2, "部门"), ITEM(3, "产品"); public static final Integer[] ARRAYS = Arrays.stream(values()).map(CrmSalesTargetDimensionEnum::getType).toArray(Integer[]::new); /** * 维度类型 */ private final Integer type; /** * 维度名称 */ private final String name; @Override public Integer[] array() { return ARRAYS; } public static CrmSalesTargetDimensionEnum fromType(Integer type) { return Arrays.stream(values()) .filter(value -> value.getType().equals(type)) .findFirst() .orElse(null); } }