From 2f74a0e6c101edc69de6d5e19e7c071e09a9c3ea Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期三, 01 四月 2026 10:44:41 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-system/src/main/resources/mapper/system/DeviceUsageMapper.xml |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/DeviceUsageMapper.xml b/ruoyi-system/src/main/resources/mapper/system/DeviceUsageMapper.xml
index f74dc0b..25ca488 100644
--- a/ruoyi-system/src/main/resources/mapper/system/DeviceUsageMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/DeviceUsageMapper.xml
@@ -124,7 +124,11 @@
     <select id="errorList" resultType="com.ruoyi.system.vo.ErrorListVo">
         select t1.*,t2.project_id,t2.plan_id,t3.`name` as  projectName,t4.`name` as planName
              ,t5.description as problemName,IF(t1.device_id is null ,1,2) as type,t2.create_time as checkTime
-        ,IF(t6.state  is null,0,t6.state+1) as state
+        ,
+        case
+        when t6.id is null then 3
+        else t6.state
+        end as state
         from record t1
                  LEFT JOIN task t2 on t1.check_task_id = t2.id
                  LEFT JOIN project t3 on t2.project_id = t3.id
@@ -132,7 +136,7 @@
                  LEFT JOIN problem t5 ON t1.problem_id = t5.id
         left join error_review t6 on t1.error_review_id = t6.id
         where t1.deleted = 0 and t2.deleted = 0  and t1.`level` =0
-          <if test="query.recordIds != null">
+          <if test="query.recordIds != null and query.recordIds.size()>0 ">
             and t1.id in
             <foreach item="item" index="index" collection="query.recordIds" open="(" separator="," close=")">
                 #{item}
@@ -160,11 +164,21 @@
         <if test="query.type != null and query.type == 2">
             and t1.device_id is not null
         </if>
+        <if test="query.startTime != null and query.startTime !='' ">
+            and t2.create_time >= #{query.startTime}
+        </if>
+          <if test="query.endTime != null and query.endTime !='' ">
+            and #{query.endTime} >= t2.create_time
+        </if>
 
         <if test="query.content!= null and query.content!=''">
             and (t3.name like CONCAT('%', #{query.content}, '%')
                 or
             t5.name like CONCAT('%', #{query.content}, '%')
+                or
+            t5.description like CONCAT('%', #{query.content}, '%')
+                or
+            t1.hierarchy_name like CONCAT('%', #{query.content}, '%')
                 or
             t1.remark like CONCAT('%', #{query.content}, '%')
                 )
@@ -174,7 +188,10 @@
     <select id="deviceErrorList" resultType="com.ruoyi.system.vo.ErrorListVo">
         select t1.*,t2.project_id,t2.plan_id,t3.`name` as  projectName,t4.`name` as planName
         ,t5.description as problemName,IF(t1.device_id is null ,1,2) as type,t1.create_time as checkTime
-        ,IF(t6.state  is null,0,t6.state+1) as state
+        ,  case
+        when t6.id is null then 3
+        else t6.state
+        end as state
         from record t1
         LEFT JOIN task t2 on t1.check_task_id = t2.id
         LEFT JOIN project t3 on t2.project_id = t3.id
@@ -218,7 +235,10 @@
     <select id="safetyErrorList" resultType="com.ruoyi.system.vo.ErrorListVo">
         select t1.*,t2.project_id,t2.plan_id,t3.`name` as  projectName,t4.`name` as planName
         ,t5.description as problemName,IF(t1.device_id is null ,1,2) as type,t1.create_time as checkTime
-        ,IF(t6.state  is null,0,t6.state+1) as state
+        ,  case
+        when t6.id is null then 3
+        else t6.state
+        end as state
         from record t1
         LEFT JOIN task t2 on t1.check_task_id = t2.id
         LEFT JOIN project t3 on t2.project_id = t3.id

--
Gitblit v1.7.1