| | |
| | | <select id="getUnclosedValves" resultType="com.dy.pipIrrGlobal.voRm.VoUnclosedValve"> |
| | | SELECT |
| | | inta.name AS intakeNum, |
| | | <!-- rtus.isOnLine,--> |
| | | IFNULL(rtus.isOnLine,'未知') AS isOnLine, |
| | | com.rtu_addr AS rtuAddr, |
| | | com.param ->> '$.icCardNo' AS vcNum, |
| | |
| | | WHEN com.command_code = 'A1' OR com.command_code = 'A2' THEN 0 |
| | | ELSE 0 |
| | | END AS planned, |
| | | com.send_time AS sendTime |
| | | com.send_time AS sendTime, |
| | | |
| | | <!--同卡、同设备的最后一次工作报的时间和瞬时流量,工作报时间必须晚于同卡、同设备最后一次开阀记录的开阀时间--> |
| | | (SELECT dt FROM rm_work_report_last |
| | | WHERE rtu_addr = com.rtu_addr AND ic_card_no = com.param ->> '$.icCardNo' |
| | | AND dt > (SELECT op_dt FROM rm_open_close_valve_last WHERE rtu_addr = com.rtu_addr AND op_ic_card_no = com.param ->> '$.icCardNo' ORDER BY op_dt DESC LIMIT 1) |
| | | ORDER BY dt DESC |
| | | LIMIT 1) AS dt, |
| | | |
| | | (SELECT water_instant FROM rm_work_report_last |
| | | WHERE rtu_addr = com.rtu_addr AND ic_card_no = com.param ->> '$.icCardNo' |
| | | AND dt > (SELECT op_dt FROM rm_open_close_valve_last WHERE rtu_addr = com.rtu_addr AND op_ic_card_no = com.param ->> '$.icCardNo' ORDER BY op_dt DESC LIMIT 1) |
| | | ORDER BY dt DESC |
| | | LIMIT 1) AS waterInstant |
| | | |
| | | 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 |
| | |
| | | LIMIT 1 |
| | | ) IS NULL |
| | | </where> |
| | | GROUP BY inta.name, rtus.isOnLine, com.rtu_addr, com.param ->> '$.icCardNo', com.command_code, com.send_time |
| | | GROUP BY inta.name, rtus.isOnLine, com.rtu_addr, com.param ->> '$.icCardNo', com.command_code, com.send_time, dt, waterInstant |
| | | ORDER BY com.send_time DESC |
| | | LIMIT 1 |
| | | </select> |