From c377b6abc119bd6acf4ea3a95a6a309caa28c46b Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期五, 06 十二月 2024 14:54:33 +0800
Subject: [PATCH] 优化代码 获取工单详情接口  修改处理结果状态         获取工单列表接口  修改处理结果状态

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeIssueReportMapper.xml |   92 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 92 insertions(+), 0 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeIssueReportMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeIssueReportMapper.xml
index 8dedb69..8ae72d4 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeIssueReportMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeIssueReportMapper.xml
@@ -170,4 +170,96 @@
       `state` = #{state,jdbcType=TINYINT}
     where id = #{id,jdbcType=BIGINT}
   </update>
+
+  <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇宸℃鍛橀棶棰樹笂鎶ユ暟閲�-->
+  <select id="getIssueReportsCount" resultType="java.lang.Long">
+    SELECT COUNT(*) AS recordCount
+    FROM ope_issue_report rpt
+        LEFT JOIN ba_user us ON us.id = rpt.inspector_id
+        LEFT JOIN ope_report_reply rpy ON rpy.report_id = rpt.id
+    <where>
+      AND rpt.state != 3
+
+      <if test="inspectorId != null">
+        AND rpt.inspector_id = #{inspectorId}
+      </if>
+
+      <if test="inspectorName != null and inspectorName != ''">
+        AND us.name like CONCAT('%', #{inspectorName}, '%')
+      </if>
+
+      <if test="content != null and content != ''">
+        AND rpt.content like CONCAT('%', #{content}, '%')
+      </if>
+
+      <if test="timeStart != null and timeStop != null ">
+        AND rpt.report_time BETWEEN #{timeStart} AND #{timeStop}
+      </if>
+
+      <if test="state != null">
+        AND rpt.state = #{state}
+      </if>
+    </where>
+  </select>
+
+  <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇宸℃鍛橀棶棰樹笂鎶�-->
+  <select id="getIssueReports" resultType="com.dy.pipIrrGlobal.voOp.VoIssueReport_temp">
+    SELECT
+        rpt.id AS issueReportId,
+        us.name AS inspectorName,
+        rpt.phone,
+        rpt.report_time AS reportTime,
+        rpt.content,
+        rpt.images,
+        rpt.audios,
+        rpt.videos,
+        rpy.reply_time AS replyTime,
+        rpt.state AS stateId,
+        CASE
+            WHEN rpt.state = 1 THEN '鏈彈鐞�'
+            WHEN rpt.state = 2 THEN '宸插彈鐞�'
+        END AS state
+    FROM ope_issue_report rpt
+        LEFT JOIN ba_user us ON us.id = rpt.inspector_id
+        LEFT JOIN ope_report_reply rpy ON rpy.report_id = rpt.id
+    <where>
+      AND rpt.state != 3
+
+      <if test="inspectorId != null">
+        AND rpt.inspector_id = #{inspectorId}
+      </if>
+
+      <if test="inspectorName != null and inspectorName != ''">
+        AND us.name like CONCAT('%', #{inspectorName}, '%')
+      </if>
+
+      <if test="content != null and content != ''">
+        AND rpt.content like CONCAT('%', #{content}, '%')
+      </if>
+
+      <if test="timeStart != null and timeStop != null ">
+        AND rpt.report_time BETWEEN #{timeStart} AND #{timeStop}
+      </if>
+
+      <if test="state != null">
+        AND rpt.state = #{state}
+      </if>
+    </where>
+    ORDER BY rpt.report_time DESC
+    <trim prefix="limit ">
+      <if test="start != null and count != null">
+        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
+      </if>
+    </trim>
+  </select>
+
+  <!--鏍规嵁涓婃姤ID鍙婂贰妫�鍛業D鑾峰彇鏈垹闄ょ殑涓婃姤锛屽垹闄や笂鎶ュ垽鏂娇鐢�-->
+  <select id="getReport" resultType="com.dy.pipIrrGlobal.pojoOp.OpeIssueReport">
+    SELECT * FROM ope_issue_report WHERE state != 3 AND id = #{issueReportId} AND inspector_id = #{inspectorId}
+  </select>
+
+  <!--閫昏緫鍒犻櫎涓�涓啘鎴烽棶棰樹笂鎶�-->
+  <update id="deleteIssueReport">
+    UPDATE ope_issue_report SET state = 3 WHERE id = #{issueReportId}
+  </update>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0