From e49b4ed39fa32266ca89e3eaeeeec1f78c42d4b3 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期一, 11 十一月 2024 14:27:05 +0800 Subject: [PATCH] 工单任务类型自动初始化 --- pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml | 48 +++++++++++++++++++++++++++++------------------- 1 files changed, 29 insertions(+), 19 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml index 5a14b0e..9925f62 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml @@ -199,7 +199,8 @@ <select id="getUnclosedValves" resultType="com.dy.pipIrrGlobal.voRm.VoUnclosedValve"> SELECT inta.name AS intakeNum, - rtus.isOnLine, +<!-- rtus.isOnLine,--> + IFNULL(rtus.isOnLine,'鏈煡') AS isOnLine, com.rtu_addr AS rtuAddr, com.param ->> '$.icCardNo' AS vcNum, ( @@ -212,10 +213,13 @@ 'toClose' AS state, CASE WHEN com.command_code = 'A1' OR com.command_code = 'A2' THEN 0 - END AS planned + ELSE 0 + END AS planned, + com.send_time AS sendTime FROM rm_command_history com - INNER JOIN pr_intake inta ON inta.id = com.intake_id - INNER JOIN JSON_TABLE( + INNER JOIN pr_controller con ON com.rtu_addr = con.rtuAddr + INNER JOIN pr_intake inta ON con.intakeId = inta.id + LEFT JOIN JSON_TABLE( <!-- '[{"rtuAddr":"620201000030","isOnLine":true}]',--> #{onLineMap}, '$[*]' COLUMNS ( @@ -225,15 +229,23 @@ ) rtus ON com.rtu_addr = rtus.rtuAddr <where> AND com.operator = #{operator} - AND (com.protocol = 'p206V1_0_1' AND (com.command_code = '92' OR com.command_code = '97' OR com.command_code = '99' OR com.command_code = 'A0' OR com.command_code = 'A1' OR com.command_code = 'A2')) - AND NOT EXISTS( - SELECT * FROM rm_command_history - WHERE (result IS NULL OR result = 1) - AND (com.protocol = 'p206V1_0_1' AND (command_code = '93' OR command_code = '98' OR command_code = '00')) - AND param ->> '$.orderNo' = com.param ->> '$.orderNo' - ) + AND ((com.protocol = 'p206V1' OR com.protocol = 'p206V2') AND (com.command_code = '92' OR com.command_code = '97' OR com.command_code = '99' OR com.command_code = 'A0' OR com.command_code = 'A1' OR com.command_code = 'A2')) + AND ( + 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 + ) IS NOT NULL + AND ( + SELECT cl_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 + ) IS NULL </where> - GROUP BY inta.name, rtus.isOnLine, com.rtu_addr, com.param ->> '$.icCardNo', com.command_code + GROUP BY inta.name, rtus.isOnLine, com.rtu_addr, com.param ->> '$.icCardNo', com.command_code, com.send_time + ORDER BY com.send_time DESC + LIMIT 1 </select> <!--鏍规嵁鍙栨按鍙D鑾峰彇璇ュ彇姘村彛鏈叧闃�鍙傛暟--> @@ -270,8 +282,6 @@ SELECT COUNT(*) AS recordCount FROM rm_command_history his INNER JOIN pr_intake inta ON inta.id = his.intake_id - LEFT JOIN se_client cli ON cli.id = his.operator - LEFT JOIN ba_user user ON user.id = his.operator <where> <if test="intakeId != null"> AND his.intake_id = #{intakeId} @@ -291,17 +301,17 @@ <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鍛戒护鏃ュ織鍘嗗彶璁板綍--> <select id="getCommandHistories" resultType="com.dy.pipIrrGlobal.voRm.VoCommand"> SELECT his.com_id AS comId, - his.command_name AS commandName, + CONCAT(his.command_name, '(', his.command_code, ')') AS commandName, inta.name AS intakeName, his.rtu_addr AS rtuAddr, - his.protocol, + his.protocol AS protocol, his.send_time AS sendTime, his.result_time AS resultTime, (CASE WHEN his.result = 1 THEN '鎴愬姛' ELSE '澶辫触' - END) AS result, - his.result_text, + END) AS state, + his.result_text AS result, IFNULL(cli.name, user.name) AS userName FROM rm_command_history his INNER JOIN pr_intake inta ON inta.id = his.intake_id @@ -322,7 +332,7 @@ AND his.send_time BETWEEN #{timeStart} AND #{timeStop} </if> </where> - ORDER BY his.send_time DESC + ORDER BY his.com_id DESC <trim prefix="limit "> <if test="start != null and count != null"> #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} -- Gitblit v1.8.0