From e9e91d14c9436b29292054e3de0445dbb7d8601c Mon Sep 17 00:00:00 2001 From: wuzeyu <1223318623@qq.com> Date: 星期三, 12 六月 2024 09:17:14 +0800 Subject: [PATCH] 修改 检测控制取水口列表 增加排序asc --- pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml | 91 +++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 87 insertions(+), 4 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml index c99a293..2ee04fa 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml @@ -219,6 +219,7 @@ LEFT JOIN ba_district country ON ge.countyId = country.id LEFT JOIN ba_district town ON ge.townId = town.id LEFT JOIN ba_district village ON ge.villageId = village.id + LEFT JOIN pr_controller cont ON ge.id = cont.intakeId <where> ge.deleted = 0 AND divi.deleted = 0 @@ -227,11 +228,11 @@ AND ge.name LIKE CONCAT('%', #{intakeName}, '%') </if> - <if test = "divideId != null"> + <if test = "divideId != null and divideId !=''"> AND divi.id = #{divideId} </if> - <if test = "blockId != null"> + <if test = "blockId != null and blockId !=''"> AND blo.id = #{blockId} </if> @@ -259,6 +260,8 @@ divi.`name` AS divideName, CAST(blo.id AS char) AS blockId, blo.`name` AS blockName, + CAST(cont.id AS char) AS controllerId, + cont.rtuAddr AS rtuAddr, ge.lng, ge.lat, ge.remarks, @@ -275,6 +278,7 @@ LEFT JOIN ba_district country ON ge.countyId = country.id LEFT JOIN ba_district town ON ge.townId = town.id LEFT JOIN ba_district village ON ge.villageId = village.id + LEFT JOIN pr_controller cont ON ge.id = cont.intakeId <where> ge.deleted = 0 AND divi.deleted = 0 @@ -283,11 +287,11 @@ AND ge.name LIKE CONCAT('%', #{intakeName}, '%') </if> - <if test = "divideId != null"> + <if test = "divideId != null and divideId !=''"> AND divi.id = #{divideId} </if> - <if test = "blockId != null"> + <if test = "blockId != null and blockId !=''"> AND blo.id = #{blockId} </if> @@ -354,4 +358,83 @@ WHERE id NOT IN(SELECT intakeId FROM pr_controller) AND deleted = 0 </select> + <!--鑾峰彇鍙栨按鍙f暟閲忥紙鍦ㄧ嚎鍜屼笉鍦ㄥ厛锛�--> + <select id="getOnLineIntakesCount" resultType="java.lang.Long"> + SELECT + COUNT(*) AS recordCount + FROM pr_controller con + INNER JOIN pr_intake inta ON con.intakeId = inta.id + left JOIN JSON_TABLE( + <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',--> + #{onLineMap}, + '$[*]' COLUMNS( + rtuAddr VARCHAR(20) PATH '$.rtuAddr', + isOnLine BOOLEAN PATH '$.isOnLine' + ) + ) rtus ON con.rtuAddr = rtus.rtuAddr + <where> + <if test="isOnLine != null"> + rtus.isOnLine = #{isOnLine} + </if> + <if test="intakeNum != null and intakeNum != ''"> + AND inta.name LIKE CONCAT('%', #{intakeNum}, '%') + </if> + </where> + </select> + + <!--鑾峰彇鍙栨按鍙e垪琛紙鍦ㄧ嚎鍜屼笉鍦ㄥ厛锛�--> + <select id="getOnLineIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake"> + SELECT + con.intakeId, + con.rtuAddr, + inta.name AS intakeNum, + rtus.isOnLine + FROM pr_controller con + INNER JOIN pr_intake inta ON con.intakeId = inta.id + left JOIN JSON_TABLE( + <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',--> + #{onLineMap}, + '$[*]' COLUMNS( + rtuAddr VARCHAR(20) PATH '$.rtuAddr', + isOnLine BOOLEAN PATH '$.isOnLine' + ) + ) rtus ON con.rtuAddr = rtus.rtuAddr + <where> + <if test="isOnLine != null"> + rtus.isOnLine = #{isOnLine} + </if> + <if test="intakeNum != null and intakeNum != ''"> + AND inta.name LIKE CONCAT('%', #{intakeNum}, '%') + </if> + </where> + order by con.id ASC + <if test="pageCurr != null and pageSize != null"> + LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} + </if> + </select> + + <!--鏍规嵁鎿嶄綔鍛樿幏鍙栧父鐢ㄥ彇姘村彛--> + <select id="getUsedIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake"> + SELECT + DISTINCT con.intakeId, + con.rtuAddr, + inta.name AS intakeNum, + rtus.isOnLine + FROM pr_controller con + INNER JOIN pr_intake inta ON con.intakeId = inta.id + INNER JOIN rm_command_history com ON con.rtuAddr = com.rtu_addr + INNER JOIN JSON_TABLE( + <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',--> + #{onLineMap}, + '$[*]' COLUMNS( + rtuAddr VARCHAR(20) PATH '$.rtuAddr', + isOnLine BOOLEAN PATH '$.isOnLine' + ) + ) rtus ON con.rtuAddr = rtus.rtuAddr + <where> + <if test="operator != null"> + com.operator = #{operator} + </if> + </where> + </select> </mapper> \ No newline at end of file -- Gitblit v1.8.0