Преглед изворни кода

修复农小禹设备统计问题

jiuling пре 10 месеци
родитељ
комит
d290685af3

+ 3 - 3
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/domain/enums/DeviceTypeEnum.java

@@ -5,10 +5,10 @@ package com.ruoyi.base.domain.enums;
  */
 public enum DeviceTypeEnum {
     
-    SENSOR("1", "采集设备", "sensor"),
+    SENSOR("1,4", "采集设备", "sensor"),
     MONITOR("2", "监控设备", "monitor"),
     CONTROL("3", "控制设备", "control"),
-    WEATHER("4", "灌溉设备", "irrigation"),  // 在前端被展示为"灌溉设备"
+    WEATHER("6", "灌溉设备", "irrigation"),  // 在前端被展示为"灌溉设备"
     TRACTOR("5", "农机设备", "tractor");
 
     private final String code;
@@ -50,7 +50,7 @@ public enum DeviceTypeEnum {
      */
     public static DeviceTypeEnum getByCode(String code) {
         for (DeviceTypeEnum type : DeviceTypeEnum.values()) {
-            if (type.getCode().equals(code)) {
+            if (type.getCode().equals(code) || type.getCode().contains(code)) {
                 return type;
             }
         }

+ 6 - 1
ruoyi-modules/ruoyi-base/src/main/resources/mapper/base/DeviceMapper.xml

@@ -218,7 +218,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="fieldId != null  and fieldId != ''"> and fd.field_id = #{fieldId}</if>
             <if test="userId != null  and userId != ''"> and fp.user_id = #{userId}</if>
             <if test="deviceName != null  and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>
-            <if test="deviceTypeId != null  and deviceTypeId != ''"> and d.device_type_id = #{deviceTypeId}</if>
+            <if test="deviceTypeId != null and deviceTypeId != ''">
+                and d.device_type_id in
+                <foreach item="id" collection="deviceTypeId.split(',')" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
             <if test="status != null "> and d.status = #{status}</if>
             <if test="deviceQueryParams != null and deviceQueryParams != ''">
                 and (