|  |  | 
 |  |  |         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} | 
 |  |  | 
 |  |  |     <!--根据指定条件获取命令日志历史记录--> | 
 |  |  |     <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 | 
 |  |  | 
 |  |  |                 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} |