Merge branch 'main' of https://git.ngsk.tech/linweidong/besure_server
commit
5a27d83074
@ -0,0 +1,88 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.dvrepair.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 维修状态枚举
|
||||
* 0-待完成 1-通过 2-不通过
|
||||
*/
|
||||
@Getter
|
||||
public enum RepairEnum {
|
||||
|
||||
PENDING(0, "待维修"),
|
||||
PASSED(1, "通过"),
|
||||
FAILED(2, "不通过");
|
||||
|
||||
private final Integer code;
|
||||
private final String description;
|
||||
|
||||
RepairEnum(Integer code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取枚举
|
||||
*/
|
||||
public static RepairEnum getByCode(Integer code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
}
|
||||
for (RepairEnum status : values()) {
|
||||
if (status.getCode().equals(code)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取描述
|
||||
*/
|
||||
public static String getDescriptionByCode(Integer code) {
|
||||
RepairEnum status = getByCode(code);
|
||||
return status != null ? status.getDescription() : "未知";
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查code是否有效
|
||||
*/
|
||||
public static boolean isValidCode(Integer code) {
|
||||
return getByCode(code) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有code列表
|
||||
*/
|
||||
public static List<Integer> getAllCodes() {
|
||||
return Arrays.stream(values())
|
||||
.map(RepairEnum::getCode)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有描述列表
|
||||
*/
|
||||
public static List<String> getAllDescriptions() {
|
||||
return Arrays.stream(values())
|
||||
.map(RepairEnum::getDescription)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取code和描述的映射
|
||||
*/
|
||||
public static Map<Integer, String> getCodeDescriptionMap() {
|
||||
Map<Integer, String> map = new LinkedHashMap<>();
|
||||
for (RepairEnum status : values()) {
|
||||
map.put(status.getCode(), status.getDescription());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.dvrepair.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 状态枚举
|
||||
* 0-待完成 1-已完成
|
||||
*/
|
||||
@Getter
|
||||
public enum StatusEnum {
|
||||
|
||||
PENDING(0, "待完成"),
|
||||
COMPLETED(1, "已完成");
|
||||
|
||||
private final Integer code;
|
||||
private final String description;
|
||||
|
||||
StatusEnum(Integer code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取枚举
|
||||
*/
|
||||
public static StatusEnum getByCode(Integer code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
}
|
||||
for (StatusEnum status : values()) {
|
||||
if (status.getCode().equals(code)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取描述
|
||||
*/
|
||||
public static String getDescriptionByCode(Integer code) {
|
||||
StatusEnum status = getByCode(code);
|
||||
return status != null ? status.getDescription() : "未知";
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查code是否有效
|
||||
*/
|
||||
public static boolean isValidCode(Integer code) {
|
||||
return getByCode(code) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有code列表
|
||||
*/
|
||||
public static List<Integer> getAllCodes() {
|
||||
return Arrays.stream(values())
|
||||
.map(StatusEnum::getCode)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有描述列表
|
||||
*/
|
||||
public static List<String> getAllDescriptions() {
|
||||
return Arrays.stream(values())
|
||||
.map(StatusEnum::getDescription)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取code和描述的映射
|
||||
*/
|
||||
public static Map<Integer, String> getCodeDescriptionMap() {
|
||||
Map<Integer, String> map = new LinkedHashMap<>();
|
||||
for (StatusEnum status : values()) {
|
||||
map.put(status.getCode(), status.getDescription());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 作业结果枚举
|
||||
* 0-待完成 1-通过 2-不通过
|
||||
*/
|
||||
@Getter
|
||||
public enum JobResultEnum {
|
||||
|
||||
PENDING(0, "待完成"),
|
||||
PASSED(1, "通过"),
|
||||
FAILED(2, "不通过");
|
||||
|
||||
private final Integer code;
|
||||
private final String description;
|
||||
|
||||
JobResultEnum(Integer code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取枚举
|
||||
*/
|
||||
public static JobResultEnum getByCode(Integer code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
}
|
||||
for (JobResultEnum result : values()) {
|
||||
if (result.getCode().equals(code)) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取描述
|
||||
*/
|
||||
public static String getDescriptionByCode(Integer code) {
|
||||
JobResultEnum result = getByCode(code);
|
||||
return result != null ? result.getDescription() : "未知";
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查code是否有效
|
||||
*/
|
||||
public static boolean isValidCode(Integer code) {
|
||||
return getByCode(code) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有code列表
|
||||
*/
|
||||
public static List<Integer> getAllCodes() {
|
||||
return Arrays.stream(values())
|
||||
.map(JobResultEnum::getCode)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有描述列表
|
||||
*/
|
||||
public static List<String> getAllDescriptions() {
|
||||
return Arrays.stream(values())
|
||||
.map(JobResultEnum::getDescription)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取code和描述的映射
|
||||
*/
|
||||
public static Map<Integer, String> getCodeDescriptionMap() {
|
||||
Map<Integer, String> map = new LinkedHashMap<>();
|
||||
for (JobResultEnum result : values()) {
|
||||
map.put(result.getCode(), result.getDescription());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue