From c9f39a721e2e0320012d0b15a931f33160ac51ae Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期二, 29 十月 2024 09:01:31 +0800
Subject: [PATCH] 命令日志查询增加一个state属性,并优化SQL

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml |   12 +++++-------
 1 files changed, 5 insertions(+), 7 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 98054c7..8f00124 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml
@@ -275,8 +275,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}
@@ -296,17 +294,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
@@ -327,7 +325,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