| New file | 
 |  |  | 
 |  |  | <?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.RmTimingReportHistoryMapper"> | 
 |  |  |   <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmTimingReportHistory"> | 
 |  |  |     <!--@mbg.generated--> | 
 |  |  |     <!--@Table rm_timing_report_history--> | 
 |  |  |     <id column="id" jdbcType="BIGINT" property="id" /> | 
 |  |  |     <result column="controller_id" jdbcType="BIGINT" property="controllerId" /> | 
 |  |  |     <result column="intake_id" jdbcType="BIGINT" property="intakeId" /> | 
 |  |  |     <result column="rtu_addr" jdbcType="VARCHAR" property="rtuAddr" /> | 
 |  |  |     <result column="dt" jdbcType="TIMESTAMP" property="dt" /> | 
 |  |  |     <result column="rtu_dt" jdbcType="TIMESTAMP" property="rtuDt" /> | 
 |  |  |     <result column="data_dt" jdbcType="DATE" property="dataDt" /> | 
 |  |  |     <result column="water_total_amount_year" jdbcType="FLOAT" property="waterTotalAmountYear" /> | 
 |  |  |     <result column="water_total_amount_meter" jdbcType="FLOAT" property="waterTotalAmountMeter" /> | 
 |  |  |     <result column="ele_total_amount_year" jdbcType="FLOAT" property="eleTotalAmountYear" /> | 
 |  |  |     <result column="ele_total_amount_meter" jdbcType="FLOAT" property="eleTotalAmountMeter" /> | 
 |  |  |     <result column="water_total_amount_day" jdbcType="FLOAT" property="waterTotalAmountDay" /> | 
 |  |  |     <result column="water_user_total_amount_day" jdbcType="FLOAT" property="waterUserTotalAmountDay" /> | 
 |  |  |     <result column="loss_total_amount_day" jdbcType="FLOAT" property="lossTotalAmountDay" /> | 
 |  |  |     <result column="battery_volt" jdbcType="FLOAT" property="batteryVolt" /> | 
 |  |  |   </resultMap> | 
 |  |  |   <sql id="Base_Column_List"> | 
 |  |  |     <!--@mbg.generated--> | 
 |  |  |     id, controller_id, intake_id, rtu_addr, dt, rtu_dt, data_dt, water_total_amount_year,  | 
 |  |  |     water_total_amount_meter, ele_total_amount_year, ele_total_amount_meter, water_total_amount_day,  | 
 |  |  |     water_user_total_amount_day, loss_total_amount_day, battery_volt | 
 |  |  |   </sql> | 
 |  |  |   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 
 |  |  |     <!--@mbg.generated--> | 
 |  |  |     select  | 
 |  |  |     <include refid="Base_Column_List" /> | 
 |  |  |     from rm_timing_report_history | 
 |  |  |     where id = #{id,jdbcType=BIGINT} | 
 |  |  |   </select> | 
 |  |  |   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> | 
 |  |  |     <!--@mbg.generated--> | 
 |  |  |     delete from rm_timing_report_history | 
 |  |  |     where id = #{id,jdbcType=BIGINT} | 
 |  |  |   </delete> | 
 |  |  |   <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmTimingReportHistory"> | 
 |  |  |     <!--@mbg.generated--> | 
 |  |  |     insert into rm_timing_report_history (id, controller_id, intake_id,  | 
 |  |  |       rtu_addr, dt, rtu_dt,  | 
 |  |  |       data_dt, water_total_amount_year, water_total_amount_meter,  | 
 |  |  |       ele_total_amount_year, ele_total_amount_meter, water_total_amount_day,  | 
 |  |  |       water_user_total_amount_day, loss_total_amount_day,  | 
 |  |  |       battery_volt) | 
 |  |  |     values (#{id,jdbcType=BIGINT}, #{controllerId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT},  | 
 |  |  |       #{rtuAddr,jdbcType=VARCHAR}, #{dt,jdbcType=TIMESTAMP}, #{rtuDt,jdbcType=TIMESTAMP},  | 
 |  |  |       #{dataDt,jdbcType=DATE}, #{waterTotalAmountYear,jdbcType=FLOAT}, #{waterTotalAmountMeter,jdbcType=FLOAT},  | 
 |  |  |       #{eleTotalAmountYear,jdbcType=FLOAT}, #{eleTotalAmountMeter,jdbcType=FLOAT}, #{waterTotalAmountDay,jdbcType=FLOAT},  | 
 |  |  |       #{waterUserTotalAmountDay,jdbcType=FLOAT}, #{lossTotalAmountDay,jdbcType=FLOAT},  | 
 |  |  |       #{batteryVolt,jdbcType=FLOAT}) | 
 |  |  |   </insert> | 
 |  |  |   <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmTimingReportHistory"> | 
 |  |  |     <!--@mbg.generated--> | 
 |  |  |     insert into rm_timing_report_history | 
 |  |  |     <trim prefix="(" suffix=")" suffixOverrides=","> | 
 |  |  |       <if test="id != null"> | 
 |  |  |         id, | 
 |  |  |       </if> | 
 |  |  |       <if test="controllerId != null"> | 
 |  |  |         controller_id, | 
 |  |  |       </if> | 
 |  |  |       <if test="intakeId != null"> | 
 |  |  |         intake_id, | 
 |  |  |       </if> | 
 |  |  |       <if test="rtuAddr != null"> | 
 |  |  |         rtu_addr, | 
 |  |  |       </if> | 
 |  |  |       <if test="dt != null"> | 
 |  |  |         dt, | 
 |  |  |       </if> | 
 |  |  |       <if test="rtuDt != null"> | 
 |  |  |         rtu_dt, | 
 |  |  |       </if> | 
 |  |  |       <if test="dataDt != null"> | 
 |  |  |         data_dt, | 
 |  |  |       </if> | 
 |  |  |       <if test="waterTotalAmountYear != null"> | 
 |  |  |         water_total_amount_year, | 
 |  |  |       </if> | 
 |  |  |       <if test="waterTotalAmountMeter != null"> | 
 |  |  |         water_total_amount_meter, | 
 |  |  |       </if> | 
 |  |  |       <if test="eleTotalAmountYear != null"> | 
 |  |  |         ele_total_amount_year, | 
 |  |  |       </if> | 
 |  |  |       <if test="eleTotalAmountMeter != null"> | 
 |  |  |         ele_total_amount_meter, | 
 |  |  |       </if> | 
 |  |  |       <if test="waterTotalAmountDay != null"> | 
 |  |  |         water_total_amount_day, | 
 |  |  |       </if> | 
 |  |  |       <if test="waterUserTotalAmountDay != null"> | 
 |  |  |         water_user_total_amount_day, | 
 |  |  |       </if> | 
 |  |  |       <if test="lossTotalAmountDay != null"> | 
 |  |  |         loss_total_amount_day, | 
 |  |  |       </if> | 
 |  |  |       <if test="batteryVolt != null"> | 
 |  |  |         battery_volt, | 
 |  |  |       </if> | 
 |  |  |     </trim> | 
 |  |  |     <trim prefix="values (" suffix=")" suffixOverrides=","> | 
 |  |  |       <if test="id != null"> | 
 |  |  |         #{id,jdbcType=BIGINT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="controllerId != null"> | 
 |  |  |         #{controllerId,jdbcType=BIGINT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="intakeId != null"> | 
 |  |  |         #{intakeId,jdbcType=BIGINT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="rtuAddr != null"> | 
 |  |  |         #{rtuAddr,jdbcType=VARCHAR}, | 
 |  |  |       </if> | 
 |  |  |       <if test="dt != null"> | 
 |  |  |         #{dt,jdbcType=TIMESTAMP}, | 
 |  |  |       </if> | 
 |  |  |       <if test="rtuDt != null"> | 
 |  |  |         #{rtuDt,jdbcType=TIMESTAMP}, | 
 |  |  |       </if> | 
 |  |  |       <if test="dataDt != null"> | 
 |  |  |         #{dataDt,jdbcType=DATE}, | 
 |  |  |       </if> | 
 |  |  |       <if test="waterTotalAmountYear != null"> | 
 |  |  |         #{waterTotalAmountYear,jdbcType=FLOAT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="waterTotalAmountMeter != null"> | 
 |  |  |         #{waterTotalAmountMeter,jdbcType=FLOAT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="eleTotalAmountYear != null"> | 
 |  |  |         #{eleTotalAmountYear,jdbcType=FLOAT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="eleTotalAmountMeter != null"> | 
 |  |  |         #{eleTotalAmountMeter,jdbcType=FLOAT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="waterTotalAmountDay != null"> | 
 |  |  |         #{waterTotalAmountDay,jdbcType=FLOAT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="waterUserTotalAmountDay != null"> | 
 |  |  |         #{waterUserTotalAmountDay,jdbcType=FLOAT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="lossTotalAmountDay != null"> | 
 |  |  |         #{lossTotalAmountDay,jdbcType=FLOAT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="batteryVolt != null"> | 
 |  |  |         #{batteryVolt,jdbcType=FLOAT}, | 
 |  |  |       </if> | 
 |  |  |     </trim> | 
 |  |  |   </insert> | 
 |  |  |   <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmTimingReportHistory"> | 
 |  |  |     <!--@mbg.generated--> | 
 |  |  |     update rm_timing_report_history | 
 |  |  |     <set> | 
 |  |  |       <if test="controllerId != null"> | 
 |  |  |         controller_id = #{controllerId,jdbcType=BIGINT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="intakeId != null"> | 
 |  |  |         intake_id = #{intakeId,jdbcType=BIGINT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="rtuAddr != null"> | 
 |  |  |         rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, | 
 |  |  |       </if> | 
 |  |  |       <if test="dt != null"> | 
 |  |  |         dt = #{dt,jdbcType=TIMESTAMP}, | 
 |  |  |       </if> | 
 |  |  |       <if test="rtuDt != null"> | 
 |  |  |         rtu_dt = #{rtuDt,jdbcType=TIMESTAMP}, | 
 |  |  |       </if> | 
 |  |  |       <if test="dataDt != null"> | 
 |  |  |         data_dt = #{dataDt,jdbcType=DATE}, | 
 |  |  |       </if> | 
 |  |  |       <if test="waterTotalAmountYear != null"> | 
 |  |  |         water_total_amount_year = #{waterTotalAmountYear,jdbcType=FLOAT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="waterTotalAmountMeter != null"> | 
 |  |  |         water_total_amount_meter = #{waterTotalAmountMeter,jdbcType=FLOAT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="eleTotalAmountYear != null"> | 
 |  |  |         ele_total_amount_year = #{eleTotalAmountYear,jdbcType=FLOAT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="eleTotalAmountMeter != null"> | 
 |  |  |         ele_total_amount_meter = #{eleTotalAmountMeter,jdbcType=FLOAT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="waterTotalAmountDay != null"> | 
 |  |  |         water_total_amount_day = #{waterTotalAmountDay,jdbcType=FLOAT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="waterUserTotalAmountDay != null"> | 
 |  |  |         water_user_total_amount_day = #{waterUserTotalAmountDay,jdbcType=FLOAT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="lossTotalAmountDay != null"> | 
 |  |  |         loss_total_amount_day = #{lossTotalAmountDay,jdbcType=FLOAT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="batteryVolt != null"> | 
 |  |  |         battery_volt = #{batteryVolt,jdbcType=FLOAT}, | 
 |  |  |       </if> | 
 |  |  |     </set> | 
 |  |  |     where id = #{id,jdbcType=BIGINT} | 
 |  |  |   </update> | 
 |  |  |   <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmTimingReportHistory"> | 
 |  |  |     <!--@mbg.generated--> | 
 |  |  |     update rm_timing_report_history | 
 |  |  |     set controller_id = #{controllerId,jdbcType=BIGINT}, | 
 |  |  |       intake_id = #{intakeId,jdbcType=BIGINT}, | 
 |  |  |       rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, | 
 |  |  |       dt = #{dt,jdbcType=TIMESTAMP}, | 
 |  |  |       rtu_dt = #{rtuDt,jdbcType=TIMESTAMP}, | 
 |  |  |       data_dt = #{dataDt,jdbcType=DATE}, | 
 |  |  |       water_total_amount_year = #{waterTotalAmountYear,jdbcType=FLOAT}, | 
 |  |  |       water_total_amount_meter = #{waterTotalAmountMeter,jdbcType=FLOAT}, | 
 |  |  |       ele_total_amount_year = #{eleTotalAmountYear,jdbcType=FLOAT}, | 
 |  |  |       ele_total_amount_meter = #{eleTotalAmountMeter,jdbcType=FLOAT}, | 
 |  |  |       water_total_amount_day = #{waterTotalAmountDay,jdbcType=FLOAT}, | 
 |  |  |       water_user_total_amount_day = #{waterUserTotalAmountDay,jdbcType=FLOAT}, | 
 |  |  |       loss_total_amount_day = #{lossTotalAmountDay,jdbcType=FLOAT}, | 
 |  |  |       battery_volt = #{batteryVolt,jdbcType=FLOAT} | 
 |  |  |     where id = #{id,jdbcType=BIGINT} | 
 |  |  |   </update> | 
 |  |  |  | 
 |  |  |   <!--根据指定条件获取定时报历史记录数量--> | 
 |  |  |   <select id="getTimingReportsCount_history" resultType="java.lang.Long"> | 
 |  |  |     SELECT | 
 |  |  |         COUNT(*) AS recordCount | 
 |  |  |     FROM rm_timing_report_history tim | 
 |  |  |         INNER JOIN pr_intake inta ON inta.id = tim.intake_id | 
 |  |  |     <where> | 
 |  |  |       <if test="intakeId != null and intakeId >0"> | 
 |  |  |         AND tim.intake_id = #{intakeId} | 
 |  |  |       </if> | 
 |  |  |       <if test = "intakeNum != null and intakeNum !=''"> | 
 |  |  |         AND inta.name LIKE CONCAT('%',#{intakeNum},'%') | 
 |  |  |       </if> | 
 |  |  |       <if test = "rtuAddr != null and rtuAddr !=''"> | 
 |  |  |         AND tim.rtu_addr LIKE CONCAT('%',#{rtuAddr},'%') | 
 |  |  |       </if> | 
 |  |  |       <if test = "timeStart != null and timeStop != null"> | 
 |  |  |         AND tim.dt BETWEEN #{timeStart} AND #{timeStop} | 
 |  |  |       </if> | 
 |  |  |     </where> | 
 |  |  |   </select> | 
 |  |  |  | 
 |  |  |   <!--根据指定条件获取定时报历史记录--> | 
 |  |  |   <select id="getTimingReports_history" resultType="com.dy.pipIrrGlobal.voRm.VoTiming"> | 
 |  |  |     SELECT | 
 |  |  |       tim.intake_id AS intakeId, | 
 |  |  |       inta.name AS intakenum, | 
 |  |  |       tim.rtu_addr AS rtuAddr, | 
 |  |  |       tim.dt AS receiveTime, | 
 |  |  |       tim.water_total_amount_year AS waterTotalAmountYear, | 
 |  |  |       tim.water_total_amount_meter AS waterTotalAmountMeter, | 
 |  |  |       tim.ele_total_amount_year AS eleTotalAmountYear, | 
 |  |  |       tim.ele_total_amount_meter AS eleTotalAmountMeter, | 
 |  |  |       tim.water_total_amount_day AS waterTotalAmountDay, | 
 |  |  |       tim.water_user_total_amount_day AS waterUserTotalAmountDay, | 
 |  |  |       tim.loss_total_amount_day AS lossTotalAmountDay, | 
 |  |  |       tim.battery_volt AS batteryVolt | 
 |  |  |     FROM rm_timing_report_history tim | 
 |  |  |     INNER JOIN pr_intake inta ON inta.id = tim.intake_id | 
 |  |  |     <where> | 
 |  |  |       <if test="intakeId != null and intakeId >0"> | 
 |  |  |         AND tim.intake_id = #{intakeId} | 
 |  |  |       </if> | 
 |  |  |       <if test = "intakeNum != null and intakeNum !=''"> | 
 |  |  |         AND inta.name LIKE CONCAT('%',#{intakeNum},'%') | 
 |  |  |       </if> | 
 |  |  |       <if test = "rtuAddr != null and rtuAddr !=''"> | 
 |  |  |         AND tim.rtu_addr LIKE CONCAT('%',#{rtuAddr},'%') | 
 |  |  |       </if> | 
 |  |  |       <if test = "timeStart != null and timeStop != null"> | 
 |  |  |         AND tim.dt BETWEEN #{timeStart} AND #{timeStop} | 
 |  |  |       </if> | 
 |  |  |     </where> | 
 |  |  |     ORDER BY tim.dt DESC, tim.loss_total_amount_day DESC | 
 |  |  |     <trim prefix="limit " > | 
 |  |  |       <if test="start != null and count != null"> | 
 |  |  |         #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} | 
 |  |  |       </if> | 
 |  |  |     </trim> | 
 |  |  |   </select> | 
 |  |  | </mapper> |