From b1d76ff75fef33e8b2307f3a8c2f4ec5e638f0cd Mon Sep 17 00:00:00 2001
From: shenyijian <1178253012@qq.com>
Date: Sat, 02 Nov 2024 14:45:08 +0800
Subject: [PATCH] 湖北水库:项目单位过滤

---
 skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProgressReportMapper.xml |   61 ++++++++++++++++++++++++++++--
 1 files changed, 56 insertions(+), 5 deletions(-)

diff --git a/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProgressReportMapper.xml b/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProgressReportMapper.xml
index 4107f18..acdad21 100644
--- a/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProgressReportMapper.xml
+++ b/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProgressReportMapper.xml
@@ -62,6 +62,15 @@
         <if test="dto.endTime != null and dto.endTime != ''">
             and report.create_time &lt;= #{dto.endTime}
         </if>
+        <if test="dto.typeName != null and dto.typeName != ''">
+            and dict.DICT_KEY  = #{dto.typeName}
+            <if test="dto.childTypeList != null and !dto.childTypeList.isEmpty()">
+                or dict.DICT_KEY in
+                <foreach collection="dto.childTypeList" open="(" close=")" separator="," item="id">
+                    #{id}
+                </foreach>
+            </if>
+        </if>
         order by report.report_time desc
     </select>
 
@@ -84,7 +93,7 @@
         DBMS_LOB.SUBSTR(report.video_urls) videoUrls,
         de.device_name,
         de.device_type,
-        userR.approval_status,
+        MAX(userR.approval_status) as approval_status,
         dict."DICT_VALUE" as typeName,
         si.control_unit,si.self_unit,dria."county_cd"
         FROM
@@ -96,11 +105,23 @@
         LEFT JOIN ywxt.sg_report_user userR ON report.id = userR.report_id
         WHERE
         1 = 1 and report."STATUS" != 4
-        <if test="dto.userUnit != null and dto.userUnit != ''">
-            and  si.CONTROL_UNIT=#{dto.userUnit}
+        <if test="dto.selfUnit != null and dto.selfUnit.size>0">
+            and
+            <foreach collection="dto.selfUnit" item="item" index="index" open="(" separator="or" close=")">
+                si.CONSTRUCTION_UNIT Like  CONCAT(CONCAT('%', #{item}), '%')
+            </foreach>
         </if>
-        <if test="dto.countryUnit != null and dto.countryUnit != ''">
-            and dria."county_cd"=#{dto.userUnit}
+        <if test="dto.userUnit != null and dto.userUnit.size>0">
+            and
+            <foreach collection="dto.userUnit" item="item" index="index" open="(" separator="or" close=")">
+                si.CONTROL_UNIT Like  CONCAT(CONCAT('%', #{item}), '%')
+            </foreach>
+        </if>
+        <if test="dto.countryUnit != null and dto.countryUnit.size>0">
+            and dria."county_cd" in
+            <foreach collection="dto.countryUnit" item="item" index="index" open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
         <if test="dto.roleUnit != null and dto.roleUnit != ''">
             and userR.role_id=#{dto.roleUnit}
@@ -130,6 +151,24 @@
         <if test="dto.endTime != null and dto.endTime !='' ">
             and report.report_time &lt;= #{dto.endTime}
         </if>
+        group by
+        report.id,
+        report.program_name,
+        report.gx_step_name,
+        report."STATUS",
+        report.audit_person,
+        report.report_time,
+        report.create_time,
+        report.gx_progress,
+        report.remark,
+        DBMS_LOB.SUBSTR( report.images_urls) ,
+        DBMS_LOB.SUBSTR( report.video_urls ) ,
+        de.device_name,
+        de.device_type,
+        dict."DICT_VALUE" ,
+        si.control_unit,
+        si.self_unit,
+        dria."county_cd"
         order by report.report_time desc
         <!--<choose >
             <when test="dto.approvalStatus != null and dto.approvalStatus == 0">
@@ -213,4 +252,16 @@
         select  u.* from ywxt.sg_report_user u left join  ywxt.sg_progresss_report r on u.report_id = r.id
         where 1=1 and r.profram_id = #{programId}
     </select>
+    <select id="getRoleByIds" resultType="java.util.Map">
+        select id,role_name as roleName from "YWXT"."BLADE_ROLE" WHERE 1=1
+        <if test="ids != null and ids.size>0">
+            AND id in
+            <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+    <select id="getSgEngineerRole" resultType="java.lang.Long">
+        select id from "YWXT"."BLADE_ROLE" where parent_id = 1800818080896073730;
+    </select>
 </mapper>

--
Gitblit v1.9.3