From 356331d8401267aa7aeb409d1314537aa25ac5ad Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期二, 25 二月 2025 14:33:03 +0800 Subject: [PATCH] 解决控制器报警与状态SQL语句的错误 --- pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmAlarmStateHistoryMapper.xml | 34 ++++++++++++++++++++-------------- 1 files changed, 20 insertions(+), 14 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmAlarmStateHistoryMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmAlarmStateHistoryMapper.xml index 069917c..5604c9a 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmAlarmStateHistoryMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmAlarmStateHistoryMapper.xml @@ -353,7 +353,7 @@ <select id="getRecordCount" resultType="java.lang.Long"> select count(*) from rm_alarm_state_history rash - Left join pr_intake pint on intake_id = pint.id + Left join pr_intake pint on rash.intake_id = pint.id <where> <if test="alarmState == 1"> and ( @@ -396,14 +396,17 @@ <if test="valveState != null"> and rash.valve_state = #{valveState,jdbcType=TINYINT} </if> - <if test="intakeName != null"> - and pint.name = #{intakeName,jdbcType=VARCHAR} + <if test="intakeId != null and intakeId != '' "> + and rash.intake_id = #{intakeId} </if> - <if test="startDt != null"> - and rash.dt >= #{startDt,jdbcType=TIMESTAMP} + <if test="intakeName != null and intakeName != '' "> + and pint.name like CONCAT('%',#{intakeName,jdbcType=VARCHAR},'%') </if> - <if test="endDt != null"> - and rash.dt <= #{endDt,jdbcType=TIMESTAMP} + <if test="startDt != null and startDt != ''"> + and rasl.dt >= #{startDt,jdbcType=TIMESTAMP} + </if> + <if test="endDt != null and endDt != ''"> + and rasl.dt <= #{endDt,jdbcType=TIMESTAMP} </if> </where> </select> @@ -434,7 +437,7 @@ rash.alarm_valve as alarmValve, rash.power_type as powerType from rm_alarm_state_history rash - Left join pr_intake pint on intake_id = pint.id + Left join pr_intake pint on rash.intake_id = pint.id <where> <if test="alarmState == 1"> and ( @@ -477,17 +480,20 @@ <if test="valveState != null"> and rash.valve_state = #{valveState,jdbcType=TINYINT} </if> - <if test="intakeName != null"> + <if test="intakeId != null and intakeId != '' "> + and rash.intake_id = #{intakeId} + </if> + <if test="intakeName != null and intakeName != '' "> and pint.name like CONCAT('%',#{intakeName,jdbcType=VARCHAR},'%') </if> - <if test="startDt != null"> - and rash.dt >= #{startDt,jdbcType=TIMESTAMP} + <if test="startDt != null and startDt != ''"> + and rasl.dt >= #{startDt,jdbcType=TIMESTAMP} </if> - <if test="endDt != null"> - and rash.dt <= #{endDt,jdbcType=TIMESTAMP} + <if test="endDt != null and endDt != ''"> + and rasl.dt <= #{endDt,jdbcType=TIMESTAMP} </if> </where> - ORDER BY rash.dt DESC + ORDER BY rash.id DESC <if test="pageCurr != null and pageSize != null"> LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} </if> -- Gitblit v1.8.0