完善jgq分支内容到master分支

This commit is contained in:
Mr.j 2025-08-06 16:23:57 +08:00
parent 64d40d0f84
commit 275cb94c02
2 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,53 @@
package com.dite.znpt.enums;
import cn.hutool.json.JSONObject;
import lombok.Getter;
import java.util.ArrayList;
import java.util.List;
/**
* @author Bear.G
* @date 2025/7/31/周四 15:30
* @description 设备健康状态枚举
*/
@Getter
public enum HealthStatusEnum {
EXCELLENT("excellent", "优秀"),
GOOD("good", "良好"),
NORMAL("normal", "一般"),
POOR("poor", "较差"),
BAD("bad", "");
private final String code;
private final String desc;
HealthStatusEnum(String code, String desc) {
this.code = code;
this.desc = desc;
}
public static HealthStatusEnum getByCode(String code) {
for (HealthStatusEnum e : HealthStatusEnum.values()) {
if (e.code.equals(code)) {
return e;
}
}
return null;
}
public static String getDescByCode(String code) {
HealthStatusEnum e = getByCode(code);
return null == e ? null : e.desc;
}
public static List<JSONObject> listAll() {
List<JSONObject> list = new ArrayList<>(HealthStatusEnum.values().length);
for (HealthStatusEnum e : HealthStatusEnum.values()) {
JSONObject jsonObject = new JSONObject();
jsonObject.set(e.code, e.desc);
list.add(jsonObject);
}
return list;
}
}

View File

@ -0,0 +1,55 @@
package com.dite.znpt.enums;
import cn.hutool.json.JSONObject;
import lombok.Getter;
import java.util.ArrayList;
import java.util.List;
/**
* @author Bear.G
* @date 2025/7/31/周四 15:30
* @description 设备位置状态枚举
*/
@Getter
public enum LocationStatusEnum {
IN_STOCK("in_stock", "库存中"),
ALLOCATED("allocated", "已分配"),
REPAIR("repair", "维修中"),
SCRAP("scrap", "待报废"),
SCRAPPED("scrapped", "已报废"),
BORROWED("borrowed", "外借中"),
LOST("lost", "丢失");
private final String code;
private final String desc;
LocationStatusEnum(String code, String desc) {
this.code = code;
this.desc = desc;
}
public static LocationStatusEnum getByCode(String code) {
for (LocationStatusEnum e : LocationStatusEnum.values()) {
if (e.code.equals(code)) {
return e;
}
}
return null;
}
public static String getDescByCode(String code) {
LocationStatusEnum e = getByCode(code);
return null == e ? null : e.desc;
}
public static List<JSONObject> listAll() {
List<JSONObject> list = new ArrayList<>(LocationStatusEnum.values().length);
for (LocationStatusEnum e : LocationStatusEnum.values()) {
JSONObject jsonObject = new JSONObject();
jsonObject.set(e.code, e.desc);
list.add(jsonObject);
}
return list;
}
}