package com.mindskip.xzs.domain.enums; import lombok.Getter; /** * @author:xp * @date:2024/5/14 9:16 */ @Getter public enum PracticeQuestionTypeEnum { ALL("all", -99,"不限类型"), SINGLE("single", 1,"单选"), MULTIPLE("multiple", 2,"多选"), JUDGE("judge", 3,"判断"), ; private final String value; /** 题目表中的值 */ private final Integer dataBaseValue; private final String desc; PracticeQuestionTypeEnum(String value, Integer dataBaseValue, String desc) { this.value = value; this.dataBaseValue = dataBaseValue; this.desc = desc; } /** * 根据值获取数据库值 * * @param value * @return */ public static Integer getDataBaseValueByValue(String value) { for (PracticeQuestionTypeEnum practiceQuestionTypeEnum : PracticeQuestionTypeEnum.values()) { if (practiceQuestionTypeEnum.getValue().equals(value)) { return practiceQuestionTypeEnum.dataBaseValue; } } return -1; } }