Commit 904ab70f authored by tianbo's avatar tianbo

refactor(jg): 优化登记类型处理逻辑

- 在 JgTableDataExportServiceImpl、JgUseRegistrationController 和 JgVehicleInformationController 中, 使用 RegTypeEnum 枚举类替换原有的 if-else逻辑来处理登记类型 - 新增 RegTypeEnum 枚举类,用于统一管理登记类型代码和名称
parent aaacbd0d
package com.yeejoin.amos.boot.module.jg.api.enums;
import java.util.Arrays;
import java.util.Optional;
/**
* 使用登记业务类型枚举
*
* @author Administrator
*/
public enum RegTypeEnum {
/**
* 使用登记业务类型枚举
*/
REGISTRATION_NEW("0", "新增登记"),
REGISTRATION_HISTORY("1", "历史登记"),
REGISTRATION_SPECIAL("2", "特殊历史登记");
private final String code;
private final String name;
RegTypeEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static Optional<String> getNameByCode(String code) {
return Arrays.stream(RegTypeEnum.values())
.filter(e -> e.getCode().equals(code))
.map(RegTypeEnum::getName)
.findFirst();
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment