From 18d0f722b1c569c881a897c8f2f50f50d624fe11 Mon Sep 17 00:00:00 2001
From: shenyijian <1178253012@qq.com>
Date: Tue, 18 Jun 2024 16:12:47 +0800
Subject: [PATCH] 湖北水库:施工:根据状态统计审批数量

---
 skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProgressReportMapper.xml |   64 ++++++++++++++++++++++++++++----
 1 files changed, 56 insertions(+), 8 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 515c3f9..7a8b44f 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
@@ -3,21 +3,41 @@
 <mapper namespace="cn.gistack.sm.sg.mapper.SgProgressReportMapper">
 
     <select id="queryPageList" resultType="cn.gistack.sm.sg.VO.SgProgressReportVO">
-        select report.* ,de.device_name,de.device_type from  SG_PROGRESS_REPORT report
-        left join  ywxt.sg_device de on report.gx_device_id = de.id
+        SELECT
+        report.*,
+        de.device_name,
+        de.device_type,
+        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
         <if test="dto.projectName != null and dto.projectName != ''">
-            and report.PROGRAM_NAME = #{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>
     </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 report.* ,de.device_name,de.device_type  from  ywxt.SG_PROGRESS_REPORT report
-            left join  ywxt.sg_device de on report.gx_device_id = de.id
-            left join ywxt.sg_report_user userR on  report.id = userR.report_id
-        where 1=1 and userR.is_his = 0 and userR.approval_order != 0
+        SELECT
+        report.*,
+        de.device_name,
+        de.device_type,
+        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'
+        LEFT JOIN ywxt.sg_report_user userR ON report.id = userR.report_id
+        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>
@@ -42,7 +62,8 @@
             step.id AS stepId,
             step.gx_step_name AS stepName,
             step.gx_step_num AS stepNum,
-            re.STATUS AS approvalStatus
+            re.STATUS AS approvalStatus,
+            re.report_time
         FROM
             ywxt.sg_gx_step step
                 LEFT JOIN ywxt.sg_gx gx ON step.gx_info_id = gx.id
@@ -51,4 +72,31 @@
         WHERE
             1 =1 and de.id = #{deviceId}
     </select>
+    <select id="statusCount" resultType="cn.gistack.sm.sg.VO.SgProgressReportVO">
+        SELECT
+        report.*,
+        de.device_name,
+        de.device_type,
+        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
+        <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>
+    </select>
+    <select id="getUserByIds" resultType="java.util.Map">
+        select id ,real_name from ywxt.blade_user  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>
 </mapper>

--
Gitblit v1.9.3