4 天以前 8f7c42bb0bced4697755299f67483be11da3e44d
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
package cn.iocoder.yudao.module.aftersales.enums;
 
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjUtil;
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
 
import java.util.Arrays;
 
/**
 * 售后业务类型枚举
 */
@RequiredArgsConstructor
@Getter
public enum AfterSaleBizTypeEnum implements ArrayValuable<Integer> {
 
    AFTER_SALE_TICKET(1, "售后工单"),
    AFTER_SALE_RETURN(2, "退货申请"),
    AFTER_SALE_REPAIR(3, "维修记录"),
    ;
 
    public static final Integer[] ARRAYS = Arrays.stream(values())
            .map(AfterSaleBizTypeEnum::getType).toArray(Integer[]::new);
 
    private final Integer type;
    private final String name;
 
    public static String getNameByType(Integer type) {
        AfterSaleBizTypeEnum typeEnum = CollUtil.findOne(CollUtil.newArrayList(AfterSaleBizTypeEnum.values()),
                item -> ObjUtil.equal(item.type, type));
        return typeEnum == null ? null : typeEnum.getName();
    }
 
    @Override
    public Integer[] array() {
        return ARRAYS;
    }
 
}