9 天以前 3411691fba52492dd417e4d7707c84f6250fff4f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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 CrmSalesTargetPeriodTypeEnum implements ArrayValuable<Integer> {
 
    YEAR(1, "年度"),
    QUARTER(2, "季度"),
    MONTH(3, "月度");
 
    public static final Integer[] ARRAYS = Arrays.stream(values()).map(CrmSalesTargetPeriodTypeEnum::getType).toArray(Integer[]::new);
 
    /**
     * 周期类型
     */
    private final Integer type;
    /**
     * 周期名称
     */
    private final String name;
 
    @Override
    public Integer[] array() {
        return ARRAYS;
    }
 
    public static CrmSalesTargetPeriodTypeEnum fromType(Integer type) {
        return Arrays.stream(values())
                .filter(value -> value.getType().equals(type))
                .findFirst()
                .orElse(null);
    }
 
}