| | |
| | | <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="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" /> |
| | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | com_id, command_code, command_name, intake_id, rtu_addr, protocol, param, send_time, |
| | | `operator`, `result`, result_time, result_text |
| | | 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"> |
| | | <!--@mbg.generated--> |
| | |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from rm_command_history |
| | | delete |
| | | from rm_command_history |
| | | where com_id = #{comId,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory"> |
| | |
| | | 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 |
| | | ) |
| | | `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} |
| | | ) |
| | | #{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--> |
| | |
| | | |
| | | <!--根据操作员ID获取未关阀记录(包含在线情况)--> |
| | | <select id="getUnclosedValves" resultType="com.dy.pipIrrGlobal.voRm.VoUnclosedValve"> |
| | | SELECT |
| | | inta.name AS intakeNum, |
| | | SELECT inta.name AS intakeNum, |
| | | rtus.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 |
| | | (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 |
| | | 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 |
| | |
| | | ) |
| | | </where> |
| | | GROUP BY inta.name, rtus.isOnLine, com.rtu_addr, com.param ->>'$.icCardNo' |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT inta.name AS intakeNum, |
| | | rtus.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, |
| | | 'toCancel' AS state |
| | | FROM rm_command_history com |
| | | INNER JOIN pr_intake inta ON inta.id = com.intake_id |
| | | INNER JOIN JSON_TABLE( |
| | | #{onLineMap}, |
| | | '$[*]' COLUMNS ( |
| | | rtuAddr VARCHAR(20) PATH '$.rtuAddr', |
| | | isOnLine BOOLEAN PATH '$.isOnLine' |
| | | ) |
| | | ) rtus ON com.rtu_addr = rtus.rtuAddr |
| | | <where> |
| | | AND (command_code = 'A1' OR command_code = 'A2') |
| | | AND com.operator = #{operator} |
| | | AND DATE_FORMAT( |
| | | CONCAT(com.param ->> '$.year', '-', com.param ->> '$.month', '-', com.param ->> '$.day', |
| | | ' ', |
| | | com.param ->> '$.hour', ':', com.param ->> '$.minute', ':', '0'), |
| | | '%Y-%m-%d %H:%i:%S') > NOW() |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据取水口ID获取该取水口未关阀参数--> |
| | | <select id="getUncloseParam" resultType="com.dy.pipIrrGlobal.voRm.VoUnclosedParam"> |
| | | SELECT |
| | | com.rtu_addr AS rtuAddr, |
| | | SELECT com.rtu_addr AS rtuAddr, |
| | | com.param ->>'$.orderNo' AS orderNo, |
| | | com.param ->>'$.icCardNo' AS vcNum |
| | | FROM rm_command_history com |
| | |
| | | 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} |
| | | 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 |
| | |
| | | |
| | | <!--根据指定条件获取命令日志历史记录总数--> |
| | | <select id="getCommandHistoriesCount" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | 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 |
| | |
| | | |
| | | <!--根据指定条件获取命令日志历史记录--> |
| | | <select id="getCommandHistories" resultType="com.dy.pipIrrGlobal.voRm.VoCommand"> |
| | | SELECT |
| | | his.com_id AS comId, |
| | | SELECT his.com_id AS comId, |
| | | his.command_name AS commandName, |
| | | inta.name AS intakeName, |
| | | his.rtu_addr AS rtuAddr, |
| | |
| | | his.send_time AS sendTime, |
| | | his.result_time AS resultTime, |
| | | (CASE |
| | | WHEN his.result = 1 THEN "成功" |
| | | ELSE "失败" |
| | | WHEN his.result = 1 THEN '成功' |
| | | ELSE '失败' |
| | | END) AS result, |
| | | his.result_text, |
| | | IFNULL(cli.name, user.name) AS userName |