TaskStatusEnum.java
1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.huaheng.common.utils;
public enum TaskStatusEnum {
TASK1(1, "生成任务"),
TASK10(10, "下达任务"),
TASK20(20, "开始执行"),
TASK30(30, "已经到站台"),
TASK100(100, "已经完成");
// TASK50(50, "XZ00014");
private Integer taskStatusName;
private String taskStatusCode;
// 构造方法
private TaskStatusEnum(Integer taskStatusName, String taskStatusCode) {
this.taskStatusName = taskStatusName;
this.taskStatusCode = taskStatusCode;
}
public static String getTaskStatusCode(Integer taskStatusName){
for (TaskStatusEnum taskStatusEnum : TaskStatusEnum.values()) {
if (taskStatusEnum.taskStatusName.equals(taskStatusName)){
return taskStatusEnum.taskStatusCode;
}
}
return null;
}
public static void main(String[] args) {
TaskStatusEnum[] values = TaskStatusEnum.values();
// for (TaskStatusEnum value : values) {
// System.out.println(value + " taskStatusCode: " + value.taskStatusCode + " taskStatusName: " + value.taskStatusName);
// }
// System.out.println("======================");
System.out.println(TaskStatusEnum.getTaskStatusCode(10));
}
}