From 8bcb47b7ea268061f4629e0953de4e3597fca690 Mon Sep 17 00:00:00 2001
From: Administrator <zhubaomin>
Date: 星期二, 16 七月 2024 22:16:53 +0800
Subject: [PATCH] 2024-07-16 朱宝民

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml |   32 +++++++++++++++-----------------
 1 files changed, 15 insertions(+), 17 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 2ef9373..f0ba647 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml
@@ -4,7 +4,7 @@
   <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
     <!--@mbg.generated-->
     <!--@Table rm_command_history-->
-    <id column="id" jdbcType="BIGINT" property="id" />
+    <id column="com_id" jdbcType="BIGINT" property="comId" />
     <result column="command_code" jdbcType="VARCHAR" property="commandCode" />
     <result column="command_name" jdbcType="VARCHAR" property="commandName" />
     <result column="intake_id" jdbcType="BIGINT" property="intakeId" />
@@ -19,7 +19,7 @@
   </resultMap>
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
-    id, command_code, command_name, intake_id, rtu_addr, protocol, param, send_time, `operator`,
+    com_id, command_code, command_name, intake_id, rtu_addr, protocol, param, send_time, `operator`,
     `result`, result_time, result_text
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
@@ -27,20 +27,20 @@
     select 
     <include refid="Base_Column_List" />
     from rm_command_history
-    where id = #{id,jdbcType=BIGINT}
+    where com_id = #{id,jdbcType=BIGINT}
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
     <!--@mbg.generated-->
     delete from rm_command_history
-    where id = #{id,jdbcType=BIGINT}
+    where com_id = #{id,jdbcType=BIGINT}
   </delete>
   <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
     <!--@mbg.generated-->
-    insert into rm_command_history (id, command_code, command_name, 
+    insert into rm_command_history (com_id, command_code, command_name,
       intake_id, rtu_addr, protocol, param,
       send_time, `operator`, `result`, 
       result_time, result_text)
-    values (#{id,jdbcType=BIGINT}, #{commandCode,jdbcType=VARCHAR}, #{commandName,jdbcType=VARCHAR}, #{intakeId,jdbcType=BIGINT},
+    values (#{comId,jdbcType=BIGINT}, #{commandCode,jdbcType=VARCHAR}, #{commandName,jdbcType=VARCHAR}, #{intakeId,jdbcType=BIGINT},
       #{rtuAddr,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
       #{sendTime,jdbcType=TIMESTAMP}, #{operator,jdbcType=BIGINT}, #{result,jdbcType=TINYINT}, 
       #{resultTime,jdbcType=TIMESTAMP}, #{resultText,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler})
@@ -49,8 +49,8 @@
     <!--@mbg.generated-->
     insert into rm_command_history
     <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
+      <if test="comId != null">
+        com_id,
       </if>
       <if test="commandCode != null">
         command_code,
@@ -87,8 +87,8 @@
       </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=BIGINT},
+      <if test="comId != null">
+        #{comId,jdbcType=BIGINT},
       </if>
       <if test="commandCode != null">
         #{commandCode,jdbcType=VARCHAR},
@@ -163,7 +163,7 @@
         result_text = #{resultText,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
       </if>
     </set>
-    where id = #{id,jdbcType=BIGINT}
+    where com_id = #{comId,jdbcType=BIGINT}
   </update>
   <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
     <!--@mbg.generated-->
@@ -179,19 +179,17 @@
       `result` = #{result,jdbcType=TINYINT},
       result_time = #{resultTime,jdbcType=TIMESTAMP},
       result_text = #{resultText,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}
-    where id = #{id,jdbcType=BIGINT}
+    where com_id = #{comId,jdbcType=BIGINT}
   </update>
 
   <!--鏍规嵁鎿嶄綔鍛業D鑾峰彇鏈叧闃�璁板綍锛堝寘鍚湪绾挎儏鍐碉級-->
   <select id="getUnclosedValves" resultType="com.dy.pipIrrGlobal.voRm.VoUnclosedValve">
     SELECT
-        com.command_code AS commandCode,
         inta.name AS intakeNum,
         rtus.isOnLine,
         com.rtu_addr AS rtuAddr,
-        com.param ->>'$.orderNo' AS orderNo,
         com.param ->>'$.icCardNo' AS vcNum,
-        com.send_time AS openTime
+        (SELECT param ->>'$.orderNo' AS orderNo FROM rm_command_history WHERE rtu_addr = com.rtu_addr ORDER BY send_time desc LIMIT 0,1) AS orderNo
     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
@@ -214,7 +212,7 @@
             AND param ->>'$.orderNo' = com.param ->>'$.orderNo'
       )
     </where>
-    ORDER BY com.send_time DESC
+    GROUP BY inta.name, rtus.isOnLine, com.rtu_addr, com.param ->>'$.icCardNo'
   </select>
 
   <!--鏍规嵁鍙栨按鍙D鑾峰彇璇ュ彇姘村彛鏈叧闃�鍙傛暟-->
@@ -270,7 +268,7 @@
   <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鍛戒护鏃ュ織鍘嗗彶璁板綍-->
   <select id="getCommandHistories" resultType="com.dy.pipIrrGlobal.voRm.VoCommand">
     SELECT
-      his.id,
+      his.com_id AS comId,
       his.command_name AS commandName,
       inta.name AS intakeName,
       his.rtu_addr AS rtuAddr,

--
Gitblit v1.8.0