From a1e7b27114eaf0bfd4d9768b76ba0db10e4d87bf Mon Sep 17 00:00:00 2001
From: yxm <zhp1521624>
Date: Wed, 17 Jul 2024 11:50:56 +0800
Subject: [PATCH] 项目查询进度添加区域筛选和白蚁项目管理优化

---
 skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProgressReportMapper.xml |   82 ++++++++++++++++++++++++++++++++++------
 1 files changed, 69 insertions(+), 13 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 29a0423..3573102 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
@@ -26,15 +26,54 @@
             and report.report_user = #{dto.reportPerson}
         </if>
     </select>
-    <select id="queryById" resultType="cn.gistack.sm.sg.VO.SgProgressReportVO">
-        select * from  SG_PROGRESS_REPORT report where id = #{id}
-    </select>
-    <select id="queryList" resultType="cn.gistack.sm.sg.VO.SgProgressReportVO">
+
+    <select id="queryPageListAll" resultType="cn.gistack.sm.sg.VO.SgProgressReportVO">
         SELECT
         report.*,
         de.device_name,
         de.device_type,
-        userR.approval_status,
+        dict."DICT_VALUE" as typeName
+        FROM
+        ywxt.SG_PROGRESS_REPORT report
+        LEFT JOIN ywxt.sg_device de ON report.gx_device_id = de.id
+        left join YWXT."BLADE_DICT_BIZ" as dict  on de.device_type=dict.DICT_KEY  and dict.CODE='SG_DEVICE_TYPE'
+        where 1=1 and report."STATUS" != 4
+        <if test="dto.projectName != null and 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.startTime != null and dto.startTime != ''">
+            and report.create_time &gt;= #{dto.startTime}
+        </if>
+        <if test="dto.endTime != null and dto.endTime != ''">
+            and report.create_time &lt;= #{dto.endTime}
+        </if>
+    </select>
+
+    <select id="queryById" resultType="cn.gistack.sm.sg.VO.SgProgressReportVO">
+        select * from  SG_PROGRESS_REPORT report where id = #{id}
+    </select>
+    <select id="queryList" resultType="cn.gistack.sm.sg.VO.SgProgressReportVO">
+        SELECT distinct
+        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) imagesUrls ,
+        DBMS_LOB.SUBSTR(report.video_urls) videoUrls,
+        de.device_name,
+        de.device_type,
+       <!-- userR.approval_status, -->
         dict."DICT_VALUE" as typeName
         FROM
         ywxt.SG_PROGRESS_REPORT report
@@ -42,18 +81,32 @@
         left join YWXT."BLADE_DICT_BIZ" as dict  on de.device_type=dict.DICT_KEY  and dict.CODE='SG_DEVICE_TYPE'
         LEFT JOIN ywxt.sg_report_user userR ON report.id = userR.report_id
         WHERE
-        1 = 1
-        AND userR.is_his = 0
+        1 = 1 and report."STATUS" != 4
+       <!-- AND userR.is_his = 0 -->
+        <if test="dto.projectName != null and 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.userId != null and dto.userId != ''">
             and userR.user_id = #{dto.userId}
         </if>
         <if test="dto.approvalStatus != null and dto.approvalStatus != 3">
-            and userR.approval_status = #{dto.approvalStatus}
+        <if test="dto.approvalStatus != null and dto.approvalStatus ==0">
+            and userR.approval_status = 0
+        </if>
+        <if test="dto.approvalStatus != null and dto.approvalStatus ==1">
+           and userR.approval_status != 0
+        </if>
             AND userR.approval_order != 0
         </if>
         <choose >
             <when test="dto.approvalStatus != null and dto.approvalStatus == 0">
-                and report.audit_person = #{dto.userId}
+                and report.audit_person = #{dto.userId} and (report."STATUS" = 0 or report."STATUS" = 1)
+            </when>
+            <when test="dto.approvalStatus != null and dto.approvalStatus == 1">
+               and report."STATUS" != 0
             </when>
             <when test="dto.approvalStatus != null and dto.approvalStatus == 3">
                 and report.report_user = #{dto.userId}
@@ -88,7 +141,7 @@
             ywxt.sg_gx_step step
                 LEFT JOIN ywxt.sg_gx gx ON step.gx_info_id = gx.id
                 LEFT JOIN ywxt.sg_device de ON gx.gx_type = de.device_type
-                LEFT JOIN ywxt.sg_progress_report re ON re.gx_step_id = step.id and re.gx_device_id = de.id
+                LEFT JOIN ywxt.sg_progress_report re ON re.gx_step_id = step.id and re.gx_device_id = de.id and re."STATUS" != 4
         WHERE
             1 =1 and de.id = #{deviceId}
     </select>
@@ -110,16 +163,19 @@
             and de.device_name like CONCAT(CONCAT('%', #{dto.deviceName}), '%')
         </if>
         <if test="dto.reportPerson != null">
-            and report.reportPerson = #{dto.reportPerson}
+            and report.report_user = #{dto.reportPerson}
         </if>
     </select>
     <select id="getUserByIds" resultType="java.util.Map">
-        select id ,real_name from ywxt.blade_user  where 1 = 1
+        select u.id ,u.real_name ,d.full_name as deptName from ywxt.blade_user u inner join ywxt.blade_dept d on u.dept_id = convert(varchar(100),d.id) where 1 = 1
         <if test="ids != null and ids.size>0">
-            AND id in
+            AND u.id in
             <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
                 #{item}
             </foreach>
         </if>
     </select>
+    <select id="selectProframId" resultType="java.lang.Long">
+        select program_id from ywxt.sg_device where id = #{deviceId}
+    </select>
 </mapper>

--
Gitblit v1.9.3