Files
JChargePointProtocol/jcpp-app/src/main/java/sanbing/jcpp/app/data/InstallModeEnum.java
2026-06-10 14:26:04 +08:00

59 lines
1.3 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 开源代码,仅供学习和交流研究使用,商用请联系三丙
* 微信mohan_88888
* 抖音:程序员三丙
* 付费课程https://www.bilibili.com/cheese/play/ss942400790
*/
package sanbing.jcpp.app.data;
import lombok.Getter;
/**
* 数据库安装模式枚举
*
* @author 九筒
*/
@Getter
public enum InstallModeEnum {
/**
* 初始化数据库执行schema-init.sql并加载演示数据
*/
INIT("init", "初始化数据库"),
/**
* 升级数据库,根据版本执行升级脚本
*/
UPGRADE("upgrade", "升级数据库"),
/**
* 不执行任何操作
*/
DISABLED("disabled", "禁用安装功能");
private final String mode;
private final String description;
InstallModeEnum(String mode, String description) {
this.mode = mode;
this.description = description;
}
/**
* 根据mode字符串获取枚举值
*/
public static InstallModeEnum fromMode(String mode) {
if (mode == null || mode.isEmpty()) {
return DISABLED;
}
for (InstallModeEnum installMode : values()) {
if (installMode.mode.equals(mode)) {
return installMode;
}
}
return DISABLED;
}
}