From f4d1e8f5e01e12a90050d94e50571b9cb1ebe109 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期五, 21 二月 2025 09:01:14 +0800 Subject: [PATCH] 灌溉模块4个接口 --- pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml | 571 ++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 384 insertions(+), 187 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 37c0c6c..992a58e 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml @@ -1,199 +1,396 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.dy.pipIrrGlobal.daoRm.RmCommandHistoryMapper"> - <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory"> - <!--@mbg.generated--> - <!--@Table rm_command_history--> - <id column="id" jdbcType="BIGINT" property="id" /> - <result column="command_code" jdbcType="VARCHAR" property="commandCode" /> - <result column="command_name" jdbcType="VARCHAR" property="commandName" /> - <result column="rtuAddr" jdbcType="VARCHAR" property="rtuaddr" /> - <result column="protocol" jdbcType="VARCHAR" property="protocol" /> - <result column="command_type" jdbcType="VARCHAR" property="commandType" /> - <result column="callBack" jdbcType="VARCHAR" property="callback" /> -<!-- <result column="param" jdbcType="VARCHAR" property="param" />--> - <result column="param" property="param" jdbcType="JAVA_OBJECT" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" /> - - <result column="send_time" jdbcType="TIMESTAMP" property="sendTime" /> - <result column="operator" jdbcType="BIGINT" property="operator" /> - <result column="result" jdbcType="TINYINT" property="result" /> - <result column="result_time" jdbcType="TIMESTAMP" property="resultTime" /> - <result column="result_text" property="resultText" jdbcType="JAVA_OBJECT" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" /> - </resultMap> - <sql id="Base_Column_List"> - <!--@mbg.generated--> - id, command_code, command_name, rtuAddr, protocol, command_type, callBack, param, - send_time, `operator`, `result`, result_time, result_text - </sql> - <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> - <!--@mbg.generated--> - select - <include refid="Base_Column_List" /> - from rm_command_history - where id = #{id,jdbcType=BIGINT} - </select> - <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> - <!--@mbg.generated--> - delete from rm_command_history - where 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, - rtuAddr, protocol, command_type, - callBack, param, send_time, - `operator`, `result`, result_time, - result_text) - values (#{id,jdbcType=BIGINT}, #{commandCode,jdbcType=VARCHAR}, #{commandName,jdbcType=VARCHAR}, - #{rtuaddr,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, #{commandType,jdbcType=VARCHAR}, - #{callback,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}) - </insert> - <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory"> - <!--@mbg.generated--> - insert into rm_command_history - <trim prefix="(" suffix=")" suffixOverrides=","> - <if test="id != null"> - id, - </if> - <if test="commandCode != null"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory"> + <!--@mbg.generated--> + <!--@Table rm_command_history--> + <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"/> + <result column="rtu_addr" jdbcType="VARCHAR" property="rtuAddr"/> + <result column="protocol" jdbcType="VARCHAR" property="protocol"/> + <result column="param" property="param" jdbcType="JAVA_OBJECT" + typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> + <result column="send_time" jdbcType="TIMESTAMP" property="sendTime"/> + <result column="operator" jdbcType="BIGINT" property="operator"/> + <result column="result" jdbcType="TINYINT" property="result"/> + <result column="result_time" jdbcType="TIMESTAMP" property="resultTime"/> + <result column="result_text" jdbcType="LONGVARCHAR" property="resultText"/> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + com_id, command_code, - </if> - <if test="commandName != null"> command_name, - </if> - <if test="rtuaddr != null"> - rtuAddr, - </if> - <if test="protocol != null"> + intake_id, + rtu_addr, protocol, - </if> - <if test="commandType != null"> - command_type, - </if> - <if test="callback != null"> - callBack, - </if> - <if test="param != null"> param, - </if> - <if test="sendTime != null"> send_time, - </if> - <if test="operator != null"> `operator`, - </if> - <if test="result != null"> `result`, - </if> - <if test="resultTime != null"> result_time, - </if> - <if test="resultText != null"> - result_text, - </if> - </trim> - <trim prefix="values (" suffix=")" suffixOverrides=","> - <if test="id != null"> - #{id,jdbcType=BIGINT}, - </if> - <if test="commandCode != null"> - #{commandCode,jdbcType=VARCHAR}, - </if> - <if test="commandName != null"> - #{commandName,jdbcType=VARCHAR}, - </if> - <if test="rtuaddr != null"> - #{rtuaddr,jdbcType=VARCHAR}, - </if> - <if test="protocol != null"> - #{protocol,jdbcType=VARCHAR}, - </if> - <if test="commandType != null"> - #{commandType,jdbcType=VARCHAR}, - </if> - <if test="callback != null"> - #{callback,jdbcType=VARCHAR}, - </if> - <if test="param != null"> - #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, - </if> - <if test="sendTime != null"> - #{sendTime,jdbcType=TIMESTAMP}, - </if> - <if test="operator != null"> - #{operator,jdbcType=BIGINT}, - </if> - <if test="result != null"> - #{result,jdbcType=TINYINT}, - </if> - <if test="resultTime != null"> - #{resultTime,jdbcType=TIMESTAMP}, - </if> - <if test="resultText != null"> - #{resultText,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, - </if> - </trim> - </insert> - <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory"> - <!--@mbg.generated--> - update rm_command_history - <set> - <if test="commandCode != null"> - command_code = #{commandCode,jdbcType=VARCHAR}, - </if> - <if test="commandName != null"> - command_name = #{commandName,jdbcType=VARCHAR}, - </if> - <if test="rtuaddr != null"> - rtuAddr = #{rtuaddr,jdbcType=VARCHAR}, - </if> - <if test="protocol != null"> - protocol = #{protocol,jdbcType=VARCHAR}, - </if> - <if test="commandType != null"> - command_type = #{commandType,jdbcType=VARCHAR}, - </if> - <if test="callback != null"> - callBack = #{callback,jdbcType=VARCHAR}, - </if> - <if test="param != null"> - param = #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, - </if> - <if test="sendTime != null"> - send_time = #{sendTime,jdbcType=TIMESTAMP}, - </if> - <if test="operator != null"> - `operator` = #{operator,jdbcType=BIGINT}, - </if> - <if test="result != null"> - `result` = #{result,jdbcType=TINYINT}, - </if> - <if test="resultTime != null"> - result_time = #{resultTime,jdbcType=TIMESTAMP}, - </if> - <if test="resultText != null"> - result_text = #{resultText,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, - </if> - </set> - where id = #{id,jdbcType=BIGINT} - </update> - <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory"> - <!--@mbg.generated--> - update rm_command_history - set command_code = #{commandCode,jdbcType=VARCHAR}, - command_name = #{commandName,jdbcType=VARCHAR}, - rtuAddr = #{rtuaddr,jdbcType=VARCHAR}, - protocol = #{protocol,jdbcType=VARCHAR}, - command_type = #{commandType,jdbcType=VARCHAR}, - callBack = #{callback,jdbcType=VARCHAR}, - param = #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, - send_time = #{sendTime,jdbcType=TIMESTAMP}, - `operator` = #{operator,jdbcType=BIGINT}, - `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} - </update> + result_text + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List"/> + from rm_command_history + where com_id = #{comId,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete + from rm_command_history + where com_id = #{comId,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory"> + <!--@mbg.generated--> + 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 (#{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=LONGVARCHAR}) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory"> + <!--@mbg.generated--> + insert into rm_command_history + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="comId != null"> + com_id, + </if> + <if test="commandCode != null"> + command_code, + </if> + <if test="commandName != null"> + command_name, + </if> + <if test="intakeId != null"> + intake_id, + </if> + <if test="rtuAddr != null"> + rtu_addr, + </if> + <if test="protocol != null"> + protocol, + </if> + <if test="param != null"> + param, + </if> + <if test="sendTime != null"> + send_time, + </if> + <if test="operator != null"> + `operator`, + </if> + <if test="result != null"> + `result`, + </if> + <if test="resultTime != null"> + result_time, + </if> + <if test="resultText != null"> + result_text, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="comId != null"> + #{comId,jdbcType=BIGINT}, + </if> + <if test="commandCode != null"> + #{commandCode,jdbcType=VARCHAR}, + </if> + <if test="commandName != null"> + #{commandName,jdbcType=VARCHAR}, + </if> + <if test="intakeId != null"> + #{intakeId,jdbcType=BIGINT}, + </if> + <if test="rtuAddr != null"> + #{rtuAddr,jdbcType=VARCHAR}, + </if> + <if test="protocol != null"> + #{protocol,jdbcType=VARCHAR}, + </if> + <if test="param != null"> + #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, + </if> + <if test="sendTime != null"> + #{sendTime,jdbcType=TIMESTAMP}, + </if> + <if test="operator != null"> + #{operator,jdbcType=BIGINT}, + </if> + <if test="result != null"> + #{result,jdbcType=TINYINT}, + </if> + <if test="resultTime != null"> + #{resultTime,jdbcType=TIMESTAMP}, + </if> + <if test="resultText != null"> + #{resultText,jdbcType=LONGVARCHAR}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory"> + <!--@mbg.generated--> + update rm_command_history + <set> + <if test="commandCode != null"> + command_code = #{commandCode,jdbcType=VARCHAR}, + </if> + <if test="commandName != null"> + command_name = #{commandName,jdbcType=VARCHAR}, + </if> + <if test="intakeId != null"> + intake_id = #{intakeId,jdbcType=BIGINT}, + </if> + <if test="rtuAddr != null"> + rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, + </if> + <if test="protocol != null"> + protocol = #{protocol,jdbcType=VARCHAR}, + </if> + <if test="param != null"> + param = #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, + </if> + <if test="sendTime != null"> + send_time = #{sendTime,jdbcType=TIMESTAMP}, + </if> + <if test="operator != null"> + `operator` = #{operator,jdbcType=BIGINT}, + </if> + <if test="result != null"> + `result` = #{result,jdbcType=TINYINT}, + </if> + <if test="resultTime != null"> + result_time = #{resultTime,jdbcType=TIMESTAMP}, + </if> + <if test="resultText != null"> + result_text = #{resultText,jdbcType=LONGVARCHAR}, + </if> + </set> + where com_id = #{comId,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory"> + <!--@mbg.generated--> + update rm_command_history + set command_code = #{commandCode,jdbcType=VARCHAR}, + command_name = #{commandName,jdbcType=VARCHAR}, + intake_id = #{intakeId,jdbcType=BIGINT}, + rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, + protocol = #{protocol,jdbcType=VARCHAR}, + param = #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, + send_time = #{sendTime,jdbcType=TIMESTAMP}, + `operator` = #{operator,jdbcType=BIGINT}, + `result` = #{result,jdbcType=TINYINT}, + result_time = #{resultTime,jdbcType=TIMESTAMP}, + result_text = #{resultText,jdbcType=LONGVARCHAR} + where com_id = #{comId,jdbcType=BIGINT} + </update> + + <!--鏍规嵁operator鑾峰彇鏈叧闃�鐨凴TU鍦板潃鍙婅櫄鎷熷崱缂栧彿鏁版嵁瀵癸紝鑾峰彇鏈叧闃�璁板綍浣跨敤--> + <select id="getUnclosedRtus" resultType="com.dy.pipIrrGlobal.voRm.VoRtuAndVc"> + SELECT + com.rtu_addr AS rtuAddr, + com.param ->> '$.icCardNo' AS vcNum + FROM rm_command_history com + where 1=1 + AND com.operator = #{operator} + AND com.result = 1 + 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 + GROUP BY com.rtu_addr, com.param ->> '$.icCardNo' + </select> + + <!--鏍规嵁RTU鍦板潃鍜岃櫄鎷熷崱缂栧彿鑾峰彇鎴愬姛寮�闃�鐨勬渶鍚庝竴鏉¤褰曪紝鑾峰彇鏈叧闃�璁板綍浣跨敤--> + <select id="getLastComId" resultType="java.lang.Long"> + SELECT com_id AS comId + FROM rm_command_history + WHERE result = 1 + AND ((protocol = 'p206V1' OR protocol = 'p206V2') + AND (command_code = '92' OR command_code = '97' OR command_code = '99' OR command_code = 'A0' OR command_code = 'A1' OR command_code = 'A2')) + AND rtu_addr = #{rtuAddr} AND param ->> '$.icCardNo' = #{vcNum} + ORDER BY send_time DESC + LIMIT 1 + </select> + + <select id="getUnclosedValves" resultType="com.dy.pipIrrGlobal.voRm.VoUnclosedValve"> + SELECT + inta.name AS intakeNum, + IFNULL(rtus.isOnLine, false) AS isOnLine, + com.rtu_addr AS rtuAddr, + com.param ->> '$.icCardNo' AS vcNum, + ( + 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, + 'toClose' AS state, + CASE + WHEN com.command_code = 'A1' OR com.command_code = 'A2' THEN 1 + ELSE 0 + END AS planned, + 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 > com.send_time + 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 > com.send_time + 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 + LEFT JOIN JSON_TABLE( + <!--'[{"rtuAddr":"620201000030","isOnLine":true}]',--> + #{onLineMap}, + '$[*]' COLUMNS ( + rtuAddr VARCHAR(20) PATH '$.rtuAddr', + isOnLine BOOLEAN PATH '$.isOnLine' + ) + ) rtus ON com.rtu_addr = rtus.rtuAddr + <where> + AND com.com_id in (${comIds}) + 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, com.send_time, dt, waterInstant + ORDER BY com.send_time DESC + </select> + + <!--鏍规嵁鍙栨按鍙D鑾峰彇璇ュ彇姘村彛鏈叧闃�鍙傛暟--> + <select id="getUncloseParam" resultType="com.dy.pipIrrGlobal.voRm.VoUnclosedParam"> + SELECT com.rtu_addr AS rtuAddr, + com.param ->> '$.orderNo' AS orderNo, + com.param ->> '$.icCardNo' AS vcNum + 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 + INNER JOIN JSON_TABLE( + <!-- '[{"rtuAddr":"620201000029","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',--> + #{onLineMap}, + '$[*]' COLUMNS ( + rtuAddr VARCHAR(20) PATH '$.rtuAddr', + isOnLine BOOLEAN PATH '$.isOnLine' + ) + ) rtus ON com.rtu_addr = rtus.rtuAddr + WHERE (com.command_code = '92' OR com.command_code = 'A2' OR com.command_code = '97') + AND con.intakeId = #{intakeId} + AND NOT EXISTS( + SELECT * + FROM rm_command_history + WHERE (result IS NULL OR result = 1) + AND (command_code = '93' OR command_code = 'A3' OR command_code = '98') + AND param ->> '$.orderNo' = com.param ->> '$.orderNo' + ) + ORDER BY com.send_time DESC + LIMIT 0,1 + </select> + + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鍛戒护鏃ュ織鍘嗗彶璁板綍鎬绘暟--> + <select id="getCommandHistoriesCount" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM rm_command_history his + INNER JOIN pr_intake inta ON inta.id = his.intake_id + <where> + <if test="intakeId != null"> + AND his.intake_id = #{intakeId} + </if> + <if test="commandName != null and commandName != ''"> + AND his.command_name LIKE CONCAT('%', #{commandName}, '%') + </if> + <if test="result != null"> + AND his.result = #{result} + </if> + <if test="timeStart != null and timeStop != null"> + AND his.send_time BETWEEN #{timeStart} AND #{timeStop} + </if> + </where> + </select> + + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鍛戒护鏃ュ織鍘嗗彶璁板綍--> + <select id="getCommandHistories" resultType="com.dy.pipIrrGlobal.voRm.VoCommand"> + SELECT his.com_id AS comId, + CONCAT(his.command_name, '(', his.command_code, ')') AS commandName, + inta.name AS intakeName, + his.rtu_addr AS rtuAddr, + his.protocol AS protocol, + his.send_time AS sendTime, + his.result_time AS resultTime, + (CASE + WHEN his.result = 1 THEN '鎴愬姛' + ELSE '澶辫触' + 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 + 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} + </if> + <if test="commandName != null and commandName != ''"> + AND his.command_name LIKE CONCAT('%', #{commandName}, '%') + </if> + <if test="result != null"> + AND his.result = #{result} + </if> + + <if test="timeStart != null and timeStop != null"> + AND his.send_time BETWEEN #{timeStart} AND #{timeStop} + </if> + </where> + 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} + </if> + </trim> + </select> + + <!--鏍规嵁鍛戒护鏃ュ織ID鑾峰彇棰勭害鏃堕棿锛屽悜铏氭嫙鍗″啓寮�闃�鏃堕棿鐢�--> + <select id="getTimeByCommId" resultType="java.lang.String"> + SELECT + CONCAT(param ->> '$.year', '-', param ->> '$.month', '-', param ->> '$.day', ' ', param ->> '$.hour', ':', param ->> '$.minute', ':00') AS openTime + FROM rm_command_history + WHERE com_id = #{commId} + </select> </mapper> \ No newline at end of file -- Gitblit v1.8.0