package cn.iocoder.yudao.module.erp.enums; import cn.iocoder.yudao.framework.common.core.ArrayValuable; import lombok.Getter; import lombok.RequiredArgsConstructor; import java.util.Arrays; import java.util.Objects; /** * ERP 销售类型枚举(销售台账) * * 字典 {@link DictTypeConstants#SALES_TYPE} */ @RequiredArgsConstructor @Getter public enum ErpSaleTypeEnum implements ArrayValuable { DOMESTIC(1, "内销"), EXPORT(2, "外销"), SAMPLE(3, "样品"), OTHER(4, "其他"); public static final Integer[] ARRAYS = Arrays.stream(values()) .map(ErpSaleTypeEnum::getType).toArray(Integer[]::new); /** * 类型值 */ private final Integer type; /** * 类型名 */ private final String name; @Override public Integer[] array() { return ARRAYS; } /** * 判断类型值是否合法(为空视为未选择,合法) */ public static boolean isValid(Integer type) { if (type == null) { return true; } return Arrays.stream(values()).anyMatch(item -> Objects.equals(item.getType(), type)); } }