package com.dsh.guns.modular.system.enums; /** * @Description 司机保证收入状态枚举 * @Author xiaochen * @Date 2023/02/15 9:42 */ public enum RuleStatusEnum { NOT_START(1, "未开始"), STARTED(2, "已开始"), ENDED(3, "已结束"), PAUSED(4,"暂停中"); private String desc; private int code; RuleStatusEnum(int code, String desc) { this.code = code; this.desc = desc; } public String getDesc() { return desc; } public int getCode() { return code; } /** * 通过code获取枚举 * * @param code * @return */ public static RuleStatusEnum fromCode(Integer code) { RuleStatusEnum[] resultTypes = RuleStatusEnum.values(); for (RuleStatusEnum resultType : resultTypes) { if (code.equals(resultType.getCode())) { return resultType; } } return null; } }