From 03448d420785c6b55987b8a8ab8f47c90195d341 Mon Sep 17 00:00:00 2001
From: lhb <1784490500@qq.com>
Date: Mon, 28 Apr 2025 11:11:43 +0800
Subject: [PATCH] =?UTF-8?q?=E7=9B=91=E7=9D=A3=E6=A3=80=E6=9F=A5=E7=BB=9F?=
 =?UTF-8?q?=E8=AE=A1=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../service/impl/THazardWorkPlanCheckServiceImpl.java | 11 +++++++++++
 .../resources/mapper/hazard/THazardWorkPlanCheck.xml  |  9 +++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/zlmy-modules/zlmy-boot/src/main/java/com/testor/module/hazard/service/impl/THazardWorkPlanCheckServiceImpl.java b/zlmy-modules/zlmy-boot/src/main/java/com/testor/module/hazard/service/impl/THazardWorkPlanCheckServiceImpl.java
index f2deff2..52a9eed 100644
--- a/zlmy-modules/zlmy-boot/src/main/java/com/testor/module/hazard/service/impl/THazardWorkPlanCheckServiceImpl.java
+++ b/zlmy-modules/zlmy-boot/src/main/java/com/testor/module/hazard/service/impl/THazardWorkPlanCheckServiceImpl.java
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.EasyExcelFactory;
 import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.util.CollectionUtils;
 import com.alibaba.excel.write.metadata.WriteSheet;
 import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -232,6 +233,11 @@ public class THazardWorkPlanCheckServiceImpl extends SuperServiceImpl<THazardWor
 
     @Override
     public List<HazardWorkPlanCheckProblemTypeStatisticsVO> selectCheckProblemTypeStatistics(THazardWorkPlanCheckParam tHazardWorkPlanCheckParam) {
+        if (CollectionUtils.isEmpty(tHazardWorkPlanCheckParam.getOrgIdList())) {
+            List<String> orgIdList = new ArrayList<>();
+            orgIdList.add(ContextUtils.getLoginUser().getOrgId());
+            tHazardWorkPlanCheckParam.setOrgIdList(orgIdList);
+        }
         tHazardWorkPlanCheckParam.setStartTime(montageStartTime(tHazardWorkPlanCheckParam.getStartTime()));
         tHazardWorkPlanCheckParam.setEndTime(montageEndTime(tHazardWorkPlanCheckParam.getEndTime()));
         return this.baseMapper.selectCheckProblemTypeStatistics(tHazardWorkPlanCheckParam);
@@ -239,6 +245,11 @@ public class THazardWorkPlanCheckServiceImpl extends SuperServiceImpl<THazardWor
 
     @Override
     public List<HazardWorkPlanCheckProblemCountStatisticsVO> selectCheckProblemCountStatistics(THazardWorkPlanCheckParam tHazardWorkPlanCheckParam) {
+        if (CollectionUtils.isEmpty(tHazardWorkPlanCheckParam.getOrgIdList())) {
+            List<String> orgIdList = new ArrayList<>();
+            orgIdList.add(ContextUtils.getLoginUser().getOrgId());
+            tHazardWorkPlanCheckParam.setOrgIdList(orgIdList);
+        }
         tHazardWorkPlanCheckParam.setStartTime(montageStartTime(tHazardWorkPlanCheckParam.getStartTime()));
         tHazardWorkPlanCheckParam.setEndTime(montageEndTime(tHazardWorkPlanCheckParam.getEndTime()));
         return this.baseMapper.selectCheckProblemCountStatistics(tHazardWorkPlanCheckParam);
diff --git a/zlmy-modules/zlmy-boot/src/main/resources/mapper/hazard/THazardWorkPlanCheck.xml b/zlmy-modules/zlmy-boot/src/main/resources/mapper/hazard/THazardWorkPlanCheck.xml
index 2bda1b7..805d50b 100644
--- a/zlmy-modules/zlmy-boot/src/main/resources/mapper/hazard/THazardWorkPlanCheck.xml
+++ b/zlmy-modules/zlmy-boot/src/main/resources/mapper/hazard/THazardWorkPlanCheck.xml
@@ -261,7 +261,6 @@
         AND hwpc.status = '0'
         AND hwpc.is_compliant = 0
         AND hwpc.problem_type IS NOT NULL
-        LEFT JOIN t_hazard_work_plan hwp ON hwpc.plan_id = hwp.id
         <if test="param.orgIdList != null and param.orgIdList.size()>0">
             and (
             <foreach item="id" collection="param.orgIdList" separator=" OR ">
@@ -269,6 +268,10 @@
             </foreach>
             )
         </if>
+        <if test="param.startTime != null and param.startTime != ''  and param.endTime != null and param.endTime != ''">
+            and hwpc.check_time between #{param.startTime} and #{param.endTime}
+        </if>
+        LEFT JOIN t_hazard_work_plan hwp ON hwpc.plan_id = hwp.id
         <if test="param.workType!=null and param.workType!=''">
             and hwp.work_type = #{param.workType}
         </if>
@@ -278,9 +281,7 @@
         <if test="param.stakeholderWork!=null and param.stakeholderWork!=''">
             and hwp.stakeholder_work = #{param.stakeholderWork}
         </if>
-        <if test="param.startTime != null and param.startTime != ''  and param.endTime != null and param.endTime != ''">
-            and hwpc.check_time between #{param.startTime} and #{param.endTime}
-        </if>
+
         GROUP BY
           dates.timeStr
         ORDER BY
-- 
2.18.1