liurunyu
2024-10-31 97c30cdf60ebd8b702bb73c62c59b512e998677a
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>