|
|
@@ -0,0 +1,69 @@
|
|
|
+package com.ruoyi.info.order.enums;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.annotation.EnumValue;
|
|
|
+import com.fasterxml.jackson.annotation.JsonCreator;
|
|
|
+import com.fasterxml.jackson.annotation.JsonValue;
|
|
|
+import com.ruoyi.common.enums.IIntegerEnum;
|
|
|
+
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
+public enum OrderOperatorType implements IIntegerEnum<Integer> {
|
|
|
+
|
|
|
+ platform(1, "平台"),
|
|
|
+ teacher(2, "管理老师"),
|
|
|
+ ;
|
|
|
+
|
|
|
+ OrderOperatorType(Integer code, String msg) {
|
|
|
+ this.code = code;
|
|
|
+ this.msg = msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ @EnumValue
|
|
|
+ @JsonValue
|
|
|
+ private Integer code;
|
|
|
+
|
|
|
+ private String msg;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Integer getCode() {
|
|
|
+ return code;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setCode(Integer code) {
|
|
|
+ this.code = code;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getMsg() {
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setMsg(String msg) {
|
|
|
+ this.msg = msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ @JsonCreator
|
|
|
+ public static OrderOperatorType getByCode(Integer code) {
|
|
|
+ for (OrderOperatorType value : OrderOperatorType.values()) {
|
|
|
+ if (Objects.equals(code, value.getCode())) {
|
|
|
+ return value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ //转成jsonarray
|
|
|
+ public static JSONArray toJsonArray() {
|
|
|
+ JSONArray jsonArray = new JSONArray();
|
|
|
+ for (OrderOperatorType value : OrderOperatorType.values()) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("code", value.getCode());
|
|
|
+ jsonObject.put("value", value.getMsg());
|
|
|
+ jsonArray.add(jsonObject);
|
|
|
+ }
|
|
|
+ return jsonArray;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|