package cn.iocoder.yudao.module.hrm.enums; import cn.iocoder.yudao.framework.common.core.ArrayValuable; import lombok.Getter; import lombok.RequiredArgsConstructor; import java.util.Arrays; /** * 考勤打卡类型枚举 */ @RequiredArgsConstructor @Getter public enum HrmAttendanceClockTypeEnum implements ArrayValuable { NORMAL(1, "正常"), LATE(2, "迟到"), EARLY(3, "早退"), MISSING(4, "缺卡"); private final Integer type; private final String name; public static final Integer[] ARRAYS = Arrays.stream(values()).map(HrmAttendanceClockTypeEnum::getType).toArray(Integer[]::new); @Override public Integer[] array() { return ARRAYS; } /** * 根据类型获取名称,未知类型返回 null */ public static String getNameByType(Integer type) { if (type == null) { return null; } for (HrmAttendanceClockTypeEnum value : values()) { if (value.getType().equals(type)) { return value.getName(); } } return null; } }