|  |  |  | 
|---|
|  |  |  | `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, | 
|---|
|  |  |  | rpy.reply_content AS replyContent, | 
|---|
|  |  |  | rpy.replier_id AS replyPersonId, | 
|---|
|  |  |  | 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及巡检员ID获取未删除的上报,删除上报判断使用--> | 
|---|
|  |  |  | <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> | 
|---|
|  |  |  | <!--根据问题上报记录主键获取获取巡检员问题上报记录视图对象--> | 
|---|
|  |  |  | <select id="getIssueReportById" 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, | 
|---|
|  |  |  | rpy.reply_content AS replyContent, | 
|---|
|  |  |  | rpy.replier_id AS replyPersonId, | 
|---|
|  |  |  | 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 rpt.state != 3 AND rpt.id = #{issueReportId} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </mapper> | 
|---|