From e77ae508afddfd24d8e713a63dfe2b3f46e9f070 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期四, 31 十月 2024 10:25:34 +0800
Subject: [PATCH] 2024-10-31 农户问题上报添加接口、查询接口、删除接口,在线查询代码优化

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

diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeIssueReportMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeIssueReportMapper.xml
index 1d9065f..8e8c84f 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeIssueReportMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeIssueReportMapper.xml
@@ -169,4 +169,87 @@
       `state` = #{state,jdbcType=TINYINT}
     where id = #{id,jdbcType=BIGINT}
   </update>
+
+  <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鍐滄埛闂涓婃姤鏁伴噺-->
+  <select id="getIssueReportsCount" resultType="java.lang.Long">
+    SELECT COUNT(*) AS recordCount
+    FROM se_issue_report rpt
+        LEFT JOIN se_client cli ON cli.id = rpt.client_id
+    <where>
+      AND rpt.state != 3
+
+      <if test="clientId != null">
+        AND rpt.client_id = #{clientId}
+      </if>
+
+      <if test="clientName != null and clientName != ''">
+        AND cli.name like CONCAT('%', #{clientName}, '%')
+      </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.voSe.VoIssueReport" >
+    SELECT
+        rpt.id AS issueReportId,
+        cli.name AS clientName,
+        rpt.phone,
+        rpt.report_time AS reportTime,
+        rpt.content,
+        rpt.images,
+        rpt.audios,
+        rpt.videos,
+        CASE
+            WHEN rpt.state = 1 THEN '鏈彈鐞�'
+            WHEN rpt.state = 2 THEN '宸插彈鐞�'
+        END AS state
+    FROM se_issue_report rpt
+        LEFT JOIN se_client cli ON cli.id = rpt.client_id
+    <where>
+      AND rpt.state != 3
+
+      <if test="clientId != null">
+        AND rpt.client_id = #{clientId}
+      </if>
+
+      <if test="clientName != null and clientName != ''">
+        AND cli.name like CONCAT('%', #{clientName}, '%')
+      </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>
+
+  <!--閫昏緫鍒犻櫎涓�涓啘鎴烽棶棰樹笂鎶�-->
+  <update id="deleteIssueReport">
+    UPDATE se_issue_report SET state = 3 WHERE id = #{issueReportId}
+  </update>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0