Explorar o código

feat: 添加设备状态描述字段

pangqijun hai 3 meses
pai
achega
7ae0891106

+ 8 - 1
src/main/java/org/springblade/common/enums/FacilityStatusEnum.java

@@ -17,5 +17,12 @@ public enum FacilityStatusEnum {
         this.value = value;
     }
 
-
+    public static String getNameByValue(Integer value) {
+        for (FacilityStatusEnum statusEnum : FacilityStatusEnum.values()) {
+            if (statusEnum.value.equals(value)) {
+                return statusEnum.getName();
+            }
+        }
+        return "未知";
+    }
 }

+ 6 - 0
src/main/java/org/springblade/modules/business/vo/FacilityVO.java

@@ -19,6 +19,7 @@ package org.springblade.modules.business.vo;
 import io.swagger.annotations.ApiModel;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
+import org.springblade.common.enums.FacilityStatusEnum;
 import org.springblade.modules.business.entity.Facility;
 
 /**
@@ -48,4 +49,9 @@ public class FacilityVO extends Facility {
      */
     private String qrCode;
 
+    private String facilityStatusDesc;
+
+    public String getFacilityStatusDesc() {
+        return FacilityStatusEnum.getNameByValue(getFacilityStatus());
+    }
 }

+ 1 - 1
src/main/resources/application-dev.yml

@@ -7,7 +7,7 @@ spring:
     ssl: false
     password: 123456789
   datasource:
-    url: jdbc:mysql://www.gzzzyd.com:10895/vend?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
+    url: jdbc:mysql://192.168.1.74:3306/vend?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
     username: root
     password: root_123
     # PostgreSQL

+ 1 - 1
src/main/resources/application-test.yml

@@ -7,7 +7,7 @@ spring:
     ssl: false
     password: 123456789
   datasource:
-    url: jdbc:mysql://www.gzzzyd.com:10895/vend?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
+    url: jdbc:mysql://192.168.1.74:3306/vend?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
     username: root
     password: root_123