|  |  | 
 |  |  |     select | 
 |  |  |     <include refid="Base_Column_List" /> | 
 |  |  |     from rm_timing_report_last | 
 |  |  |     where rtu_addr = #{rtuAddr} | 
 |  |  |     where intake_id = #{intakeId} | 
 |  |  |   </select> | 
 |  |  |  | 
 |  |  |   <!--根据指定条件获取定时报最新记录数量--> | 
 |  |  |   <select id="getTimingReportsCount_last" resultType="java.lang.Long"> | 
 |  |  |     SELECT | 
 |  |  |         COUNT(*) AS recordCount | 
 |  |  |     FROM rm_timing_report_last 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_last" 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_last 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> |