“mitao”
2026-04-01 147416cbf4810dfb16a6211c6b594a640e623553
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) 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}
@@ -142,7 +146,7 @@
        <if test="query.projectId != null">
            and t2.project_id = #{query.projectId}
        </if>
        <if test="query.state ==4 ">
        <if test="query.state ==0 ">
            and t1.error_review_id is null
        </if>
        <if test="query.state ==1 ">
@@ -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) 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
@@ -192,7 +209,7 @@
        <if test="query.projectId != null">
            and t2.project_id = #{query.projectId}
        </if>
        <if test="query.state ==4 ">
        <if test="query.state == 0">
            and t1.error_review_id is null
        </if>
        <if test="query.state ==1 ">
@@ -210,15 +227,29 @@
            or
            t5.name like CONCAT('%', #{query.content}, '%')
            or
            t5.description like CONCAT('%', #{query.content}, '%')
            or
            t1.remark like CONCAT('%', #{query.content}, '%')
            )
        </if>
        <if test="query.level != null">
            and t1.level = #{query.level}
        </if>
        <if test="query.startTime != null and query.startTime !='' ">
            and t1.create_time &gt;= #{query.startTime}
        </if>
        <if test="query.endTime != null and query.endTime !='' ">
            and #{query.endTime} &gt;= t1.create_time
        </if>
        order by t1.create_time desc
    </select>
    <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) 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
@@ -236,16 +267,16 @@
        <if test="query.projectId != null">
            and t2.project_id = #{query.projectId}
        </if>
        <if test="query.state ==4 ">
        <if test="query.state == 0 ">
            and t1.error_review_id is null
        </if>
        <if test="query.state ==1 ">
        <if test="query.state == 1 ">
            and t6.state = 0
        </if>
        <if test="query.state ==2 ">
        <if test="query.state == 2 ">
            and t6.state = 1
        </if>
        <if test="query.state ==3 ">
        <if test="query.state == 3 ">
            and t6.state = 2
        </if>
@@ -254,9 +285,20 @@
            or
            t5.name like CONCAT('%', #{query.content}, '%')
            or
            t5.description like CONCAT('%', #{query.content}, '%')
            or
            t1.remark like CONCAT('%', #{query.content}, '%')
            )
        </if>
        <if test="query.level != null">
            and t1.level = #{query.level}
        </if>
        <if test="query.startTime != null and query.startTime !='' ">
            and t1.create_time &gt;= #{query.startTime}
        </if>
        <if test="query.endTime != null and query.endTime !='' ">
            and #{query.endTime} &gt;= t1.create_time
        </if>
        order by t1.create_time desc
    </select>