From f20611265f7d34fd4fbcdfdaff6cb9cccd0b25fc Mon Sep 17 00:00:00 2001
From: shenyijian <1178253012@qq.com>
Date: Fri, 21 Jun 2024 11:53:21 +0800
Subject: [PATCH] 湖北水库:施工:项目查询过滤无效修复、根据角色查询用户

---
 skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProgressReportMapper.xml |   33 ++++++++++++++++++++++++++++-----
 1 files changed, 28 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 7a8b44f..29a0423 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
@@ -14,10 +14,16 @@
         left join YWXT."BLADE_DICT_BIZ" as dict  on de.device_type=dict.DICT_KEY  and dict.CODE='SG_DEVICE_TYPE'
         where 1=1
         <if test="dto.projectName != null and dto.projectName != ''">
-            and report.PROGRAM_NAME like CONCAT(CONCAT('%',#{dto.projectName},'%'))
+            and report.PROGRAM_NAME like CONCAT(CONCAT('%',#{dto.projectName}),'%')
         </if>
         <if test="dto.deviceName != null and dto.deviceName != ''">
             and de.device_name like CONCAT(CONCAT('%', #{dto.deviceName}), '%')
+        </if>
+        <if test="dto.status != null ">
+            and report.status = #{dto.status}
+        </if>
+        <if test="dto.reportPerson != null ">
+            and report.report_user = #{dto.reportPerson}
         </if>
     </select>
     <select id="queryById" resultType="cn.gistack.sm.sg.VO.SgProgressReportVO">
@@ -28,6 +34,7 @@
         report.*,
         de.device_name,
         de.device_type,
+        userR.approval_status,
         dict."DICT_VALUE" as typeName
         FROM
         ywxt.SG_PROGRESS_REPORT report
@@ -37,13 +44,21 @@
         WHERE
         1 = 1
         AND userR.is_his = 0
-        AND userR.approval_order != 0
         <if test="dto.userId != null and dto.userId != ''">
             and userR.user_id = #{dto.userId}
         </if>
-        <if test="dto.approvalStatus != null and dto.approvalStatus != ''">
+        <if test="dto.approvalStatus != null and dto.approvalStatus != 3">
             and userR.approval_status = #{dto.approvalStatus}
+            AND userR.approval_order != 0
         </if>
+        <choose >
+            <when test="dto.approvalStatus != null and dto.approvalStatus == 0">
+                and report.audit_person = #{dto.userId}
+            </when>
+            <when test="dto.approvalStatus != null and dto.approvalStatus == 3">
+                and report.report_user = #{dto.userId}
+            </when>
+        </choose>
     </select>
     <select id="countList" resultType="java.lang.Long">
         select count(1) from  ywxt.SG_PROGRESS_REPORT report
@@ -53,9 +68,14 @@
         <if test="dto.userId != null and dto.userId != ''">
             and userR.user_id = #{dto.userId}
         </if>
-        <if test="dto.approvalStatus != null and dto.approvalStatus != ''">
+        <if test="dto.approvalStatus != null ">
             and userR.approval_status = #{dto.approvalStatus}
         </if>
+        <choose >
+            <when test="dto.approvalStatus != null and dto.approvalStatus == 0">
+                and report.audit_person = #{dto.userId}
+            </when>
+        </choose>
     </select>
     <select id="selectByDeviceId" resultType="cn.gistack.sm.sg.VO.SgStepReportVO">
         SELECT
@@ -84,11 +104,14 @@
         left join YWXT."BLADE_DICT_BIZ" as dict  on de.device_type=dict.DICT_KEY  and dict.CODE='SG_DEVICE_TYPE'
         where 1=1
         <if test="dto.projectName != null and dto.projectName != ''">
-            and report.PROGRAM_NAME like CONCAT(CONCAT('%',#{dto.projectName},'%'))
+            and report.PROGRAM_NAME like CONCAT(CONCAT('%',#{dto.projectName}),'%')
         </if>
         <if test="dto.deviceName != null and dto.deviceName != ''">
             and de.device_name like CONCAT(CONCAT('%', #{dto.deviceName}), '%')
         </if>
+        <if test="dto.reportPerson != null">
+            and report.reportPerson = #{dto.reportPerson}
+        </if>
     </select>
     <select id="getUserByIds" resultType="java.util.Map">
         select id ,real_name from ywxt.blade_user  where 1 = 1

--
Gitblit v1.9.3