|  |  | 
 |  |  |         select | 
 |  |  |         count(*) as count | 
 |  |  |         from rm_on_hour_report_last tb | 
 |  |  |         where tb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP} | 
 |  |  |         inner join pr_intake tbIn on tb.intake_id = tbIn.id | 
 |  |  |         where tbIn.deleted != 1 and tb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP} | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <select id="mTotalCountOfNoReport" resultType="java.lang.Integer"> | 
 |  |  | 
 |  |  |                 from rm_on_hour_report_last ltb | 
 |  |  |                 where ltb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP} | 
 |  |  |             ) temTb on tb.id = temTb.intake_id | 
 |  |  |         where temTb.intake_id is null | 
 |  |  |         where tb.deleted != 1 and temTb.intake_id is null | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |                 select ltb.intake_id | 
 |  |  |                 from rm_on_hour_report_last ltb | 
 |  |  |             ) temTb on tb.id = temTb.intake_id | 
 |  |  |         where temTb.intake_id is null | 
 |  |  |         where tb.deleted != 1 and temTb.intake_id is null | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |         select | 
 |  |  |         count(*) as count | 
 |  |  |         from rm_alarm_state_last tb | 
 |  |  |         where valve_state = 0 | 
 |  |  |         inner join pr_intake tbIn on tb.intake_id = tbIn.id | 
 |  |  |         where tbIn.deleted != 1 and valve_state = 0 | 
 |  |  |         <if test="fromDt != null "> | 
 |  |  |             AND tb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP} | 
 |  |  |         </if> | 
 |  |  | 
 |  |  |         select | 
 |  |  |         count(*) as count | 
 |  |  |         from rm_alarm_state_last tb | 
 |  |  |         where valve_state = 1 | 
 |  |  |         inner join pr_intake tbIn on tb.intake_id = tbIn.id | 
 |  |  |         where tbIn.deleted != 1 and valve_state = 1 | 
 |  |  |         <if test="fromDt != null "> | 
 |  |  |             AND tb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP} | 
 |  |  |         </if> | 
 |  |  | 
 |  |  |                 select ltb.intake_id | 
 |  |  |                 from rm_alarm_state_last ltb | 
 |  |  |             ) temTb on tb.id = temTb.intake_id | 
 |  |  |         where temTb.intake_id is null | 
 |  |  |         where tb.deleted != 1 and temTb.intake_id is null | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |         select | 
 |  |  |         count(*) as count | 
 |  |  |         from rm_alarm_state_last tb | 
 |  |  |         where (alarm_remain_water = 1 or | 
 |  |  |         inner join pr_intake tbIn on tb.intake_id = tbIn.id | 
 |  |  |         where tbIn.deleted != 1 and | 
 |  |  |         (alarm_remain_water = 1 or | 
 |  |  |         alarm_exceed_year = 1 or | 
 |  |  |         alarm_water_meter_fault = 1 or | 
 |  |  |         alarm_loss = 1 or | 
 |  |  | 
 |  |  |         alarm_ele_miss = 1 or | 
 |  |  |         alarm_ele_exceed = 1 or | 
 |  |  |         alarm_ele_low_volt = 1 or | 
 |  |  |         state_ic_enable = 1 or | 
 |  |  |         alarm_battery_volt = 1 or | 
 |  |  |         alarm_valve = 1) | 
 |  |  |         <if test="fromDt != null "> | 
 |  |  | 
 |  |  |         select | 
 |  |  |         count(*) as count | 
 |  |  |         from rm_alarm_state_last tb | 
 |  |  |         where ((alarm_remain_water is null or alarm_remain_water = 0) and | 
 |  |  |         (alarm_remain_water is null or alarm_exceed_year = 0)  and | 
 |  |  |         (alarm_remain_water is null or alarm_water_meter_fault = 0)  and | 
 |  |  |         (alarm_remain_water is null or alarm_loss = 0)  and | 
 |  |  |         (alarm_remain_water is null or alarm_water_meter_break = 0)  and | 
 |  |  |         (alarm_remain_water is null or alarm_ele_meter_fault = 0)  and | 
 |  |  |         (alarm_remain_water is null or alarm_inner_door = 0)  and | 
 |  |  |         (alarm_remain_water is null or alarm_outer_door = 0)  and | 
 |  |  |         (alarm_remain_water is null or alarm_ele_miss = 0)  and | 
 |  |  |         (alarm_remain_water is null or alarm_ele_exceed = 0)  and | 
 |  |  |         (alarm_remain_water is null or alarm_ele_low_volt = 0)  and | 
 |  |  |         (alarm_remain_water is null or state_ic_enable = 0)  and | 
 |  |  |         (alarm_remain_water is null or alarm_battery_volt = 0)  and | 
 |  |  |         (alarm_remain_water is null or alarm_valve = 0) ) | 
 |  |  |         inner join pr_intake tbIn on tb.intake_id = tbIn.id | 
 |  |  |         where tbIn.deleted != 1 and | 
 |  |  |         ((alarm_remain_water is null or alarm_remain_water = 0) and | 
 |  |  |         (alarm_exceed_year is null or alarm_exceed_year = 0)  and | 
 |  |  |         (alarm_water_meter_fault is null or alarm_water_meter_fault = 0)  and | 
 |  |  |         (alarm_loss is null or alarm_loss = 0)  and | 
 |  |  |         (alarm_water_meter_break is null or alarm_water_meter_break = 0)  and | 
 |  |  |         (alarm_ele_meter_fault is null or alarm_ele_meter_fault = 0)  and | 
 |  |  |         (alarm_inner_door is null or alarm_inner_door = 0)  and | 
 |  |  |         (alarm_outer_door is null or alarm_outer_door = 0)  and | 
 |  |  |         (alarm_ele_miss is null or alarm_ele_miss = 0)  and | 
 |  |  |         (alarm_ele_exceed is null or alarm_ele_exceed = 0)  and | 
 |  |  |         (alarm_ele_low_volt is null or alarm_ele_low_volt = 0)  and | 
 |  |  |         (alarm_battery_volt is null or alarm_battery_volt = 0)  and | 
 |  |  |         (alarm_valve is null or alarm_valve = 0) ) | 
 |  |  |         <if test="fromDt != null "> | 
 |  |  |             AND tb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP} | 
 |  |  |         </if> | 
 |  |  | 
 |  |  |                    (ltb.alarm_remain_water is null or ltb.alarm_battery_volt = 0)  and | 
 |  |  |                    (ltb.alarm_remain_water is null or ltb.alarm_valve = 0) ) | 
 |  |  |         ) temTb on tb.id = temTb.intake_id | 
 |  |  |         where temTb.intake_id is null | 
 |  |  |         where tb.deleted != 1 and temTb.intake_id is null | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     <select id="topXClientAtCertainDay" resultType="com.dy.pipIrrGlobal.voSpecial.VoTopXClient"> | 
 |  |  |         select mTb.id as id, mTb.client_id as clientId, | 
 |  |  |         scTb.name as clientName, scTb.clientNum as clientNum, scTb.address as clientAddress, | 
 |  |  |         mTb.amount as amount | 
 |  |  |         from rm_client_amount_day mTb | 
 |  |  |         left join se_client scTb on scTb.id = mTb.client_id | 
 |  |  |         <where> | 
 |  |  |             <if test = "idStart != null"> | 
 |  |  |                 mTb.id <![CDATA[>=]]> #{idStart, javaType=LONG, jdbcType=BIGINT} | 
 |  |  |             </if> | 
 |  |  |             <if test = "idEnd != null"> | 
 |  |  |                 and mTb.id <![CDATA[<=]]> #{idEnd, javaType=LONG, jdbcType=BIGINT} | 
 |  |  |             </if> | 
 |  |  |         </where> | 
 |  |  |         order by mTb.amount DESC | 
 |  |  |         <trim prefix="limit " > | 
 |  |  |             <if test="count != null"> | 
 |  |  |                 0, #{count,javaType=Integer, jdbcType=INTEGER} | 
 |  |  |             </if> | 
 |  |  |         </trim> | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     <select id="topXIntakeAtCertainDay" resultType="com.dy.pipIrrGlobal.voSpecial.VoTopXIntake"> | 
 |  |  |         select mTb.id as id, mTb.intake_id as intakeId, | 
 |  |  |         piTb.name as intakeNum, piTb.lng as intakeLng, piTb.lat as intakeLat, | 
 |  |  |         mTb.amount as amount | 
 |  |  |         from rm_intake_amount_day mTb | 
 |  |  |         left join pr_intake piTb on piTb.id = mTb.intake_id | 
 |  |  |         <where> | 
 |  |  |             <if test = "idStart != null"> | 
 |  |  |                 mTb.id <![CDATA[>=]]> #{idStart, javaType=LONG, jdbcType=BIGINT} | 
 |  |  |             </if> | 
 |  |  |             <if test = "idEnd != null"> | 
 |  |  |                 and mTb.id <![CDATA[<=]]> #{idEnd, javaType=LONG, jdbcType=BIGINT} | 
 |  |  |             </if> | 
 |  |  |         </where> | 
 |  |  |         order by mTb.amount DESC | 
 |  |  |         <trim prefix="limit " > | 
 |  |  |             <if test="count != null"> | 
 |  |  |                 0, #{count,javaType=Integer, jdbcType=INTEGER} | 
 |  |  |             </if> | 
 |  |  |         </trim> | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <select id="allCropts" resultType="com.dy.pipIrrGlobal.voMd.VoCropsSimple"> | 
 |  |  |         select mTb.id as id, mTb.name as name | 
 |  |  |         from md_crops mTb | 
 |  |  |         where mTb.deleted != 1 | 
 |  |  |         order by mTb.id DESC | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <select id="et0InWeek" resultType="com.dy.pipIrrGlobal.voMd.VoEt0Simple"> | 
 |  |  |         select mTb.id as id, mTb.dt as dt, mTb.et0 as et0 | 
 |  |  |         from md_et0 mTb | 
 |  |  |         <where> | 
 |  |  |             <if test="cropId != null"> | 
 |  |  |                 AND mTb.crop_id = #{cropId} | 
 |  |  |             </if> | 
 |  |  |             <if test = "startDate != null and startDate !='' and endDate != null and endDate != ''"> | 
 |  |  |                 AND mTb.dt BETWEEN #{startDate} AND #{endDate} | 
 |  |  |             </if> | 
 |  |  |         </where> | 
 |  |  |         order by mTb.id ASC | 
 |  |  |     </select> | 
 |  |  | </mapper> |