From fc8c8356f5e95cb8317069c9986120b1ecb88851 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期四, 29 一月 2026 14:27:21 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/smart_screen

---
 ruoyi-system/src/main/resources/mapper/system/DeviceUsageMapper.xml |   36 +++++++++++++++++++++++++-----------
 1 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/DeviceUsageMapper.xml b/ruoyi-system/src/main/resources/mapper/system/DeviceUsageMapper.xml
index 1c7fd88..407ec7a 100644
--- a/ruoyi-system/src/main/resources/mapper/system/DeviceUsageMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/DeviceUsageMapper.xml
@@ -75,14 +75,9 @@
     </select>
     <select id="projectList" resultType="com.ruoyi.system.vo.EntrustProjectVo">
         select
-        t1.*, latest.record_time as checkTime,result.risk_level
+        t1.*,result.risk_level
         from project t1
-        left join device_usage t2 on t1.id = t2.project_id
-        left join (
-        select device_id, max(create_time) as record_time
-        from record
-        group by device_id
-        ) latest on t2.device_id = latest.device_id
+
         left join (
         select score,project_id,risk_level
         from eval_result
@@ -110,7 +105,7 @@
             and #{query.endTime} >=latest.record_time
         </if>
         GROUP BY t1.id
-        order by latest.record_time desc
+        order by t1.create_time desc
     </select>
     <select id="projectReport" resultType="com.ruoyi.system.vo.EntrustProjectReportVo">
         select t1.name,t1.type,t2.score,t2.risk_level,t3.time as checkTime
@@ -128,8 +123,15 @@
                  LEFT JOIN project t3 on t2.project_id = t3.id
                  LEFT JOIN plan t4 on t2.plan_id = t4.id
                  LEFT JOIN problem t5 ON t1.problem_id = t5.id
-        where t1.deleted = 0 and t2.deleted = 0  and t1.`level` =1
-          <if test="query.projectId != null">
+        where t1.deleted = 0 and t2.deleted = 0  and t1.`level` =0
+          <if test="query.recordIds != null">
+            and t1.id in
+            <foreach item="item" index="index" collection="query.recordIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+
+        <if test="query.projectId != null">
             and t2.project_id = #{query.projectId}
         </if>
         <if test="query.reformed != null">
@@ -165,7 +167,13 @@
         LEFT JOIN project t3 on t2.project_id = t3.id
         LEFT JOIN plan t4 on t2.plan_id = t4.id
         LEFT JOIN problem t5 ON t1.problem_id = t5.id
-        where t1.deleted = 0 and t2.deleted = 0  and t1.device_id is not null
+        where t1.deleted = 0 and t2.deleted = 0  and t1.device_id is not null and
+        <if test="query.recordIds != null">
+            and t1.id in
+            <foreach item="item" index="index" collection="query.recordIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
         <if test="query.projectId != null">
             and t2.project_id = #{query.projectId}
         </if>
@@ -198,6 +206,12 @@
         LEFT JOIN plan t4 on t2.plan_id = t4.id
         LEFT JOIN problem t5 ON t1.problem_id = t5.id
         where t1.deleted = 0 and t2.deleted = 0  and t1.device_id is null
+        <if test="query.recordIds != null">
+            and t1.id in
+            <foreach item="item" index="index" collection="query.recordIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
         <if test="query.projectId != null">
             and t2.project_id = #{query.projectId}
         </if>

--
Gitblit v1.7.1