“mitao”
2026-02-04 458334ecf2bf8aa76ac6d07226ed29878c56b070
ruoyi-system/src/main/resources/mapper/system/DeviceUsageMapper.xml
@@ -57,7 +57,7 @@
        group by device_id
        ) latest on t2.id = latest.device_id
        left join project t3 on t1.project_id = t3.id
        where  1=1
        where  t1.deleted = 0
        <if test="query.projectId != null">
            and t1.project_id = #{query.projectId}
        </if>
@@ -73,12 +73,7 @@
        <if test="query.content!= null and query.content!=''">
            and t2.name like CONCAT('%', #{query.content}, '%')
        </if>
        <if test="query.startTime != null and query.startTime != ''">
            and latest.record_time >= #{query.startTime}
        </if>
        <if test="query.endTime != null and query.endTime != ''">
            and #{query.endTime} >=latest.record_time
        </if>
        order by latest.record_time desc
    </select>
    <select id="projectList" resultType="com.ruoyi.system.vo.EntrustProjectVo">
@@ -92,13 +87,8 @@
        group by project_id
        order by create_time desc
        ) result on t1.id = result.project_id
        where t1.deleted = 0 and t1.status =1
        <if test="query.category == 1">
            and t1.status = #{query.category}
        </if>
        <if test="query.category == 2">
            and t1.type = #{query.category}
        </if>
        where t1.deleted = 0
        <if test="query.clientId != null">
            and t1.client_id = #{query.clientId}
        </if>
@@ -134,11 +124,13 @@
    <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.`name` 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
        from record t1
                 LEFT JOIN task t2 on t1.check_task_id = t2.id
                 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
        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">
            and t1.id in
@@ -150,8 +142,17 @@
        <if test="query.projectId != null">
            and t2.project_id = #{query.projectId}
        </if>
        <if test="query.reformed != null">
            and t1.reformed = #{query.reformed}
        <if test="query.state ==0 ">
            and t6.state is null
        </if>
        <if test="query.state ==1 ">
            and t6.state = #{query.state}
        </if>
        <if test="query.state ==2 ">
            and t6.state = #{query.state}
        </if>
        <if test="query.state ==3 ">
            and t6.state = #{query.state}
        </if>
        <if test="query.type != null and query.type == 1">
            and t1.device_id is null
@@ -159,12 +160,7 @@
        <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 t1.create_time >= #{query.startTime}
        </if>
        <if test="query.endTime != null and query.endTime != ''">
            and #{query.endTime} >=t1.create_time
        </if>
        <if test="query.content!= null and query.content!=''">
            and (t3.name like CONCAT('%', #{query.content}, '%')
                or
@@ -178,12 +174,15 @@
    <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.`name` 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
        from record t1
        LEFT JOIN task t2 on t1.check_task_id = t2.id
        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 and
        left join error_review t6 on t1.error_review_id = t6.id
        where t1.deleted = 0 and t2.deleted = 0  and t1.device_id is not null
        <if test="query.recordIds != null">
            and t1.id in
            <foreach item="item" index="index" collection="query.recordIds" open="(" separator="," close=")">
@@ -193,16 +192,19 @@
        <if test="query.projectId != null">
            and t2.project_id = #{query.projectId}
        </if>
        <if test="query.reformed != null">
            and t1.reformed = #{query.reformed}
        <if test="query.state ==0 ">
            and t6.state is null
        </if>
        <if test="query.state ==1 ">
            and t6.state = #{query.state}
        </if>
        <if test="query.state ==2 ">
            and t6.state = #{query.state}
        </if>
        <if test="query.state ==3 ">
            and t6.state = #{query.state}
        </if>
        <if test="query.startTime != null and query.startTime != ''">
            and t1.create_time >= #{query.startTime}
        </if>
        <if test="query.endTime != null and query.endTime != ''">
            and #{query.endTime} >=t1.create_time
        </if>
        <if test="query.content!= null and query.content!=''">
            and (t3.name like CONCAT('%', #{query.content}, '%')
            or
@@ -216,12 +218,15 @@
    <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.`name` 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
        from record t1
        LEFT JOIN task t2 on t1.check_task_id = t2.id
        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 null
        left join error_review t6 on t1.error_review_id = t6.id
        where t1.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=")">
@@ -231,16 +236,19 @@
        <if test="query.projectId != null">
            and t2.project_id = #{query.projectId}
        </if>
        <if test="query.reformed != null">
            and t1.reformed = #{query.reformed}
        <if test="query.state ==0 ">
            and t6.state is null
        </if>
        <if test="query.state ==1 ">
            and t6.state = #{query.state}
        </if>
        <if test="query.state ==2 ">
            and t6.state = #{query.state}
        </if>
        <if test="query.state ==3 ">
            and t6.state = #{query.state}
        </if>
        <if test="query.startTime != null and query.startTime != ''">
            and t1.create_time >= #{query.startTime}
        </if>
        <if test="query.endTime != null and query.endTime != ''">
            and #{query.endTime} >=t1.create_time
        </if>
        <if test="query.content!= null and query.content!=''">
            and (t3.name like CONCAT('%', #{query.content}, '%')
            or