| | |
| | | |
| | | <!--根据操作员获取常用取水口--> |
| | | <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 |
| | | SELECT |
| | | com.intake_id AS intakeId, |
| | | con.rtuAddr, |
| | | inta.name AS intakeNum, |
| | | rtus.isOnLine |
| | | FROM pr_common_intakes com |
| | | INNER JOIN pr_intake inta ON inta.id = com.intake_id |
| | | INNER JOIN pr_controller con ON con.intakeId = com.intake_id |
| | | INNER JOIN JSON_TABLE( |
| | | <!--'[{"rtuAddr":"620201000030","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} |
| | | com.operator_id = #{operator} |
| | | </if> |
| | | </where> |
| | | ORDER BY com.last_used_time DESC,com.usage_count DESC |
| | | </select> |
| | | |
| | | <!--取水口名称换取水口ID,扫码开阀使用--> |