| | |
| | | LIMIT 0,1 |
| | | </select> |
| | | |
| | | <!--根据取水口ID获取该取水口未关阀参数--> |
| | | <select id="getUncloseParamByCd" resultType="com.dy.pipIrrGlobal.voRm.VoUnclosedParam"> |
| | | SELECT com.rtu_addr AS rtuAddr, |
| | | com.param ->> '$.orderNo' AS orderNo, |
| | | com.param ->> '$.icCardNo' AS vcNum |
| | | FROM rm_command_history com |
| | | INNER JOIN pr_controller con ON com.rtu_addr = con.rtuAddr |
| | | INNER JOIN pr_intake inta ON con.intakeId = inta.id |
| | | INNER JOIN JSON_TABLE( |
| | | <!-- '[{"rtuAddr":"620201000029","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',--> |
| | | #{onLineMap}, |
| | | '$[*]' COLUMNS ( |
| | | rtuAddr VARCHAR(20) PATH '$.rtuAddr', |
| | | isOnLine BOOLEAN PATH '$.isOnLine' |
| | | ) |
| | | ) rtus ON com.rtu_addr = rtus.rtuAddr |
| | | WHERE com.command_code = #{code} |
| | | AND con.intakeId = #{intakeId} |
| | | AND NOT EXISTS( |
| | | SELECT * |
| | | FROM rm_command_history |
| | | WHERE (result IS NULL OR result = 1) |
| | | AND (command_code = '93' OR command_code = 'A3' OR command_code = '98') |
| | | AND param ->> '$.orderNo' = com.param ->> '$.orderNo' |
| | | ) |
| | | ORDER BY com.send_time DESC |
| | | LIMIT 0,1 |
| | | </select> |
| | | |
| | | <!--根据指定条件获取命令日志历史记录总数--> |
| | | <select id="getCommandHistoriesCount" resultType="java.lang.Long"> |
| | | SELECT COUNT(*) AS recordCount |
| | |
| | | FROM rm_command_history |
| | | WHERE com_id = #{commId} |
| | | </select> |
| | | |
| | | <!--根据命令日志ID获取开阀信息,终止灌溉计划时使用,用来执行远程关阀--> |
| | | <select id="getValveOpen" resultType="com.dy.pipIrrGlobal.voRm.VoIntakeVc"> |
| | | SELECT |
| | | rtu_addr AS rtuAddr, |
| | | param ->> '$.icCardNo' AS vcNum, |
| | | param ->> '$.orderNo' AS orderNo |
| | | FROM rm_command_history |
| | | WHERE com_id = #{commandId} |
| | | LIMIT 0, 1 |
| | | </select> |
| | | </mapper> |