|  |  |  | 
|---|
|  |  |  | <result column="state_ic_enable" jdbcType="TINYINT" property="stateIcEnable" /> | 
|---|
|  |  |  | <result column="alarm_battery_volt" jdbcType="TINYINT" property="alarmBatteryVolt" /> | 
|---|
|  |  |  | <result column="alarm_valve" jdbcType="TINYINT" property="alarmValve" /> | 
|---|
|  |  |  | <result column="power_type" jdbcType="TINYINT" property="alarmValve" /> | 
|---|
|  |  |  | <result column="send_ms_time" jdbcType="BIGINT" property="sendMsTime" /> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <sql id="Base_Column_List"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | id, controller_id, intake_id, rtu_addr, dt, rtu_dt, valve_state, alarm_remain_water, | 
|---|
|  |  |  | alarm0_water_remain, alarm_exceed_year, alarm_water_meter_fault, alarm_loss, alarm_water_meter_break, | 
|---|
|  |  |  | alarm_ele_meter_fault, alarm0_money_remain, alarm_inner_door, alarm_outer_door, alarm_ele_miss, | 
|---|
|  |  |  | alarm_ele_exceed, alarm_ele_low_volt, state_ic_enable,alarm_battery_volt,alarm_valve | 
|---|
|  |  |  | alarm_ele_exceed, alarm_ele_low_volt, state_ic_enable,alarm_battery_volt,alarm_valve,power_type,send_ms_time | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | 
|---|
|  |  |  | from rm_alarm_state_last | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <select id="selectByRtuAddr" parameterType="java.lang.String" resultMap="BaseResultMap"> | 
|---|
|  |  |  | <select id="selectByIntakeId" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | <include refid="Base_Column_List" /> | 
|---|
|  |  |  | from rm_alarm_state_last | 
|---|
|  |  |  | where rtu_addr = #{rtuAddr,jdbcType=VARCHAR} | 
|---|
|  |  |  | where intake_id = #{intakeId,jdbcType=BIGINT} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | 
|---|
|  |  |  | alarm_loss, alarm_water_meter_break, alarm_ele_meter_fault, | 
|---|
|  |  |  | alarm0_money_remain, alarm_inner_door, alarm_outer_door, | 
|---|
|  |  |  | alarm_ele_miss, alarm_ele_exceed, alarm_ele_low_volt, | 
|---|
|  |  |  | state_ic_enable,alarm_battery_volt,alarm_valve) | 
|---|
|  |  |  | state_ic_enable,alarm_battery_volt,alarm_valve,power_type, | 
|---|
|  |  |  | send_ms_time) | 
|---|
|  |  |  | values (#{id,jdbcType=BIGINT}, #{controllerId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, | 
|---|
|  |  |  | #{rtuAddr,jdbcType=VARCHAR}, #{dt,jdbcType=TIMESTAMP}, #{rtuDt,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | #{valveState,jdbcType=TINYINT}, #{alarmRemainWater,jdbcType=TINYINT}, #{alarm0WaterRemain,jdbcType=TINYINT}, | 
|---|
|  |  |  | 
|---|
|  |  |  | #{alarmLoss,jdbcType=TINYINT}, #{alarmWaterMeterBreak,jdbcType=TINYINT}, #{alarmEleMeterFault,jdbcType=TINYINT}, | 
|---|
|  |  |  | #{alarm0MoneyRemain,jdbcType=TINYINT}, #{alarmInnerDoor,jdbcType=TINYINT}, #{alarmOuterDoor,jdbcType=TINYINT}, | 
|---|
|  |  |  | #{alarmEleMiss,jdbcType=TINYINT}, #{alarmEleExceed,jdbcType=TINYINT}, #{alarmEleLowVolt,jdbcType=TINYINT}, | 
|---|
|  |  |  | #{stateIcEnable,jdbcType=TINYINT}, #{alarmBatteryVolt,jdbcType=TINYINT}, #{alarmValve,jdbcType=TINYINT}) | 
|---|
|  |  |  | #{stateIcEnable,jdbcType=TINYINT}, #{alarmBatteryVolt,jdbcType=TINYINT}, #{alarmValve,jdbcType=TINYINT}, | 
|---|
|  |  |  | #{powerType,jdbcType=TINYINT},#{sendMsTime,jdbcType=BIGINT}) | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmAlarmStateLast"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="alarmValve != null"> | 
|---|
|  |  |  | alarm_valve, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="powerType != null"> | 
|---|
|  |  |  | power_type, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="sendMsTime != null"> | 
|---|
|  |  |  | send_ms_time, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null"> | 
|---|
|  |  |  | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="alarmValve != null"> | 
|---|
|  |  |  | #{alarmValve,jdbcType=TINYINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="powerType != null"> | 
|---|
|  |  |  | #{powerType,jdbcType=TINYINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="sendMsTime != null"> | 
|---|
|  |  |  | #{sendMsTime,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="alarmValve != null"> | 
|---|
|  |  |  | alarm_valve = #{alarmValve,jdbcType=TINYINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="powerType != null"> | 
|---|
|  |  |  | power_type = #{powerType,jdbcType=TINYINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="sendMsTime != null"> | 
|---|
|  |  |  | send_ms_time = #{sendMsTime,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </set> | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  | 
|---|
|  |  |  | state_ic_enable = #{stateIcEnable,jdbcType=TINYINT}, | 
|---|
|  |  |  | alarm_battery_volt = #{alarmBatteryVolt,jdbcType=TINYINT}, | 
|---|
|  |  |  | alarm_valve = #{alarmValve,jdbcType=TINYINT}, | 
|---|
|  |  |  | power_type = #{powerType,jdbcType=TINYINT}, | 
|---|
|  |  |  | send_ms_time = #{sendMsTime,jdbcType=BIGINT} | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  | <!--根据指定条件获取记录总数--> | 
|---|
|  |  |  | <select id="getRecordCount" resultType="java.lang.Long"> | 
|---|
|  |  |  | select count(*) | 
|---|
|  |  |  | from rm_alarm_state_last rasl | 
|---|
|  |  |  | Left join pr_intake pint on intake_id = pint.id | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test="alarmState == 1"> | 
|---|
|  |  |  | and ( | 
|---|
|  |  |  | alarm_remain_water = 1 | 
|---|
|  |  |  | or alarm0_water_remain = 1 | 
|---|
|  |  |  | or alarm_exceed_year = 1 | 
|---|
|  |  |  | or alarm_water_meter_fault = 1 | 
|---|
|  |  |  | or alarm_loss = 1 | 
|---|
|  |  |  | or alarm_water_meter_break = 1 | 
|---|
|  |  |  | or alarm_ele_meter_fault = 1 | 
|---|
|  |  |  | or alarm0_money_remain = 1 | 
|---|
|  |  |  | or alarm_inner_door = 1 | 
|---|
|  |  |  | or alarm_outer_door = 1 | 
|---|
|  |  |  | or alarm_ele_miss = 1 | 
|---|
|  |  |  | or alarm_ele_exceed = 1 | 
|---|
|  |  |  | or alarm_ele_low_volt = 1 | 
|---|
|  |  |  | or alarm_battery_volt = 1 | 
|---|
|  |  |  | or alarm_valve = 1 | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="alarmState == 0"> | 
|---|
|  |  |  | and ( | 
|---|
|  |  |  | alarm_remain_water = 0 | 
|---|
|  |  |  | and alarm0_water_remain = 0 | 
|---|
|  |  |  | and alarm_exceed_year = 0 | 
|---|
|  |  |  | and alarm_water_meter_fault = 0 | 
|---|
|  |  |  | and alarm_loss = 0 | 
|---|
|  |  |  | and alarm_water_meter_break = 0 | 
|---|
|  |  |  | and alarm_ele_meter_fault = 0 | 
|---|
|  |  |  | and alarm0_money_remain = 0 | 
|---|
|  |  |  | and alarm_inner_door = 0 | 
|---|
|  |  |  | and alarm_outer_door = 0 | 
|---|
|  |  |  | and alarm_ele_miss = 0 | 
|---|
|  |  |  | and alarm_ele_exceed = 0 | 
|---|
|  |  |  | and alarm_ele_low_volt = 0 | 
|---|
|  |  |  | and alarm_battery_volt = 0 | 
|---|
|  |  |  | and alarm_valve = 0 | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="valveState != null"> | 
|---|
|  |  |  | and rasl.valve_state = #{valveState,jdbcType=TINYINT} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <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 startDt != ''"> | 
|---|
|  |  |  | and rasl.dt >= #{startDt,jdbcType=TIMESTAMP} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="endDt != null and endDt != ''"> | 
|---|
|  |  |  | and rasl.dt <= #{endDt,jdbcType=TIMESTAMP} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <!--根据指定条件获取记录--> | 
|---|
|  |  |  | <select id="getControllerAlarmStateLast" resultType="com.dy.pipIrrGlobal.voRm.VoControllerAlarmState"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | CAST(rasl.controller_id AS char)AS controllerId, | 
|---|
|  |  |  | CAST(rasl.intake_id AS char)AS intakeId, | 
|---|
|  |  |  | pint.name as intakeName, | 
|---|
|  |  |  | rasl.rtu_addr as rtuAddr, | 
|---|
|  |  |  | rasl.dt as dt, | 
|---|
|  |  |  | rasl.valve_state as valveState, | 
|---|
|  |  |  | rasl.alarm_remain_water as alarmRemainWater, | 
|---|
|  |  |  | rasl.alarm0_water_remain as alarm0WaterRemain, | 
|---|
|  |  |  | rasl.alarm_exceed_year as alarmExceedYear, | 
|---|
|  |  |  | rasl.alarm_water_meter_fault as alarmWaterMeterFault, | 
|---|
|  |  |  | rasl.alarm_loss as alarmLoss, | 
|---|
|  |  |  | rasl.alarm_water_meter_break as alarmWaterMeterBreak, | 
|---|
|  |  |  | rasl.alarm_ele_meter_fault as alarmEleMeterFault, | 
|---|
|  |  |  | rasl.alarm0_money_remain as alarm0MoneyRemain, | 
|---|
|  |  |  | rasl.alarm_inner_door as alarmInnerDoor, | 
|---|
|  |  |  | rasl.alarm_outer_door as alarmOuterDoor, | 
|---|
|  |  |  | rasl.alarm_ele_miss as alarmEleMiss, | 
|---|
|  |  |  | rasl.alarm_ele_exceed as alarmEleExceed, | 
|---|
|  |  |  | rasl.alarm_ele_low_volt as alarmEleLowVolt, | 
|---|
|  |  |  | rasl.state_ic_enable as stateIcEnable, | 
|---|
|  |  |  | rasl.alarm_battery_volt as alarmBatteryVolt, | 
|---|
|  |  |  | rasl.alarm_valve as alarmValve, | 
|---|
|  |  |  | rasl.power_type as powerType | 
|---|
|  |  |  | from rm_alarm_state_last rasl | 
|---|
|  |  |  | Left join pr_intake pint on rasl.intake_id = pint.id | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test="alarmState == 1"> | 
|---|
|  |  |  | and ( | 
|---|
|  |  |  | alarm_remain_water = 1 | 
|---|
|  |  |  | or alarm0_water_remain = 1 | 
|---|
|  |  |  | or alarm_exceed_year = 1 | 
|---|
|  |  |  | or alarm_water_meter_fault = 1 | 
|---|
|  |  |  | or alarm_loss = 1 | 
|---|
|  |  |  | or alarm_water_meter_break = 1 | 
|---|
|  |  |  | or alarm_ele_meter_fault = 1 | 
|---|
|  |  |  | or alarm0_money_remain = 1 | 
|---|
|  |  |  | or alarm_inner_door = 1 | 
|---|
|  |  |  | or alarm_outer_door = 1 | 
|---|
|  |  |  | or alarm_ele_miss = 1 | 
|---|
|  |  |  | or alarm_ele_exceed = 1 | 
|---|
|  |  |  | or alarm_ele_low_volt = 1 | 
|---|
|  |  |  | or alarm_battery_volt = 1 | 
|---|
|  |  |  | or alarm_valve = 1 | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="alarmState == 0"> | 
|---|
|  |  |  | and ( | 
|---|
|  |  |  | alarm_remain_water = 0 | 
|---|
|  |  |  | and alarm0_water_remain = 0 | 
|---|
|  |  |  | and alarm_exceed_year = 0 | 
|---|
|  |  |  | and alarm_water_meter_fault = 0 | 
|---|
|  |  |  | and alarm_loss = 0 | 
|---|
|  |  |  | and alarm_water_meter_break = 0 | 
|---|
|  |  |  | and alarm_ele_meter_fault = 0 | 
|---|
|  |  |  | and alarm0_money_remain = 0 | 
|---|
|  |  |  | and alarm_inner_door = 0 | 
|---|
|  |  |  | and alarm_outer_door = 0 | 
|---|
|  |  |  | and alarm_ele_miss = 0 | 
|---|
|  |  |  | and alarm_ele_exceed = 0 | 
|---|
|  |  |  | and alarm_ele_low_volt = 0 | 
|---|
|  |  |  | and alarm_battery_volt = 0 | 
|---|
|  |  |  | and alarm_valve = 0 | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="valveState != null"> | 
|---|
|  |  |  | and rasl.valve_state = #{valveState,jdbcType=TINYINT} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <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 startDt != ''"> | 
|---|
|  |  |  | and rasl.dt >= #{startDt,jdbcType=TIMESTAMP} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="endDt != null and endDt != ''"> | 
|---|
|  |  |  | and rasl.dt <= #{endDt,jdbcType=TIMESTAMP} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | ORDER BY rasl.id DESC | 
|---|
|  |  |  | <if test="pageCurr != null and pageSize != null"> | 
|---|
|  |  |  | LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </mapper> | 
|---|