|  |  | 
 |  |  |             </if> | 
 |  |  |         </trim> | 
 |  |  |     </select> | 
 |  |  |     <!--指定时间段用水量超过指定值的取水口数量--> | 
 |  |  |     <select id="getUseWaterGtValueIntakesCount" resultType="java.lang.Long"> | 
 |  |  |         select | 
 |  |  |             count(*) | 
 |  |  |         from | 
 |  |  |             (        SELECT | 
 |  |  |         inta.id AS intakeId, | 
 |  |  |         inta.NAME AS intakeNum, | 
 |  |  |         blo.NAME AS blockName , | 
 |  |  |         IFNULL(SUM(rocvh.cl_this_amount),0) AS value | 
 |  |  |         FROM | 
 |  |  |         pr_intake inta | 
 |  |  |         INNER JOIN ba_block blo ON blo.id = inta.blockId | 
 |  |  |         LEFT JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id | 
 |  |  |         WHERE rocvh.op_dt >= #{timeStart} AND rocvh.cl_dt <= #{timeStop} AND inta.deleted = 0 | 
 |  |  |         GROUP BY inta.id | 
 |  |  |         HAVING IFNULL(SUM(rocvh.cl_this_amount),0) > #{value}) c | 
 |  |  |     </select> | 
 |  |  |     <!--指定时间段用水量超过指定值的取水口--> | 
 |  |  |     <select id="getUseWaterGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount"> | 
 |  |  |         SELECT | 
 |  |  |             inta.id AS intakeId, | 
 |  |  |             inta.NAME AS intakeNum, | 
 |  |  |             blo.NAME AS blockName , | 
 |  |  |         IFNULL(SUM(rocvh.cl_this_amount),0) AS value | 
 |  |  |         FROM | 
 |  |  |             pr_intake inta | 
 |  |  |             INNER JOIN ba_block blo ON blo.id = inta.blockId | 
 |  |  |             LEFT JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id | 
 |  |  |         WHERE rocvh.op_dt >= #{timeStart} AND rocvh.cl_dt <= #{timeStop} AND inta.deleted = 0 | 
 |  |  |         GROUP BY inta.id | 
 |  |  |         HAVING IFNULL(SUM(rocvh.cl_this_amount),0) > #{value} | 
 |  |  |         ORDER BY inta.id | 
 |  |  |         <trim prefix="limit " > | 
 |  |  |             <if test="start != null and count != null"> | 
 |  |  |                 #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} | 
 |  |  |             </if> | 
 |  |  |         </trim> | 
 |  |  |     </select> | 
 |  |  |     <!--指定时间段内消费金额超过指定值的取水口的数量--> | 
 |  |  |     <select id="getExpenseGtValueIntakesCount" resultType="java.lang.Long"> | 
 |  |  |         select | 
 |  |  |         count(*) | 
 |  |  |         from | 
 |  |  |         (        SELECT | 
 |  |  |         inta.id AS intakeId, | 
 |  |  |         inta.NAME AS intakeNum, | 
 |  |  |         blo.NAME AS blockName , | 
 |  |  |         IFNULL(SUM(rocvh.cl_this_money),0) AS value | 
 |  |  |         FROM | 
 |  |  |         pr_intake inta | 
 |  |  |         INNER JOIN ba_block blo ON blo.id = inta.blockId | 
 |  |  |         LEFT JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id | 
 |  |  |         WHERE rocvh.op_dt >= #{timeStart} AND rocvh.cl_dt <= #{timeStop} AND inta.deleted = 0 | 
 |  |  |         GROUP BY inta.id | 
 |  |  |         HAVING IFNULL(SUM(rocvh.cl_this_money),0) > #{value}) c | 
 |  |  |     </select> | 
 |  |  |     <!--指定时间段内消费金额超过指定值的取水口--> | 
 |  |  |     <select id="getExpenseGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount"> | 
 |  |  |         SELECT | 
 |  |  |         inta.id AS intakeId, | 
 |  |  |         inta.NAME AS intakeNum, | 
 |  |  |         blo.NAME AS blockName , | 
 |  |  |         IFNULL(SUM(rocvh.cl_this_money),0) AS value | 
 |  |  |         FROM | 
 |  |  |         pr_intake inta | 
 |  |  |         INNER JOIN ba_block blo ON blo.id = inta.blockId | 
 |  |  |         LEFT JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id | 
 |  |  |         WHERE rocvh.op_dt >= #{timeStart} AND rocvh.cl_dt <= #{timeStop} AND inta.deleted = 0 | 
 |  |  |         GROUP BY inta.id | 
 |  |  |         HAVING IFNULL(SUM(rocvh.cl_this_money),0) > #{value} | 
 |  |  |         ORDER BY inta.id | 
 |  |  |         <trim prefix="limit " > | 
 |  |  |             <if test="start != null and count != null"> | 
 |  |  |                 #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} | 
 |  |  |             </if> | 
 |  |  |         </trim> | 
 |  |  |     </select> | 
 |  |  |     <!--指定时间段内用水时长超过指定值的取水口数量--> | 
 |  |  |     <select id="getUseWaterDurationGtValueIntakesCount" resultType="java.lang.Long"> | 
 |  |  |         select | 
 |  |  |         count(*) | 
 |  |  |         from | 
 |  |  |         (        SELECT | 
 |  |  |         inta.id AS intakeId, | 
 |  |  |         inta.NAME AS intakeNum, | 
 |  |  |         blo.NAME AS blockName , | 
 |  |  |         IFNULL(SUM(rocvh.cl_this_time),0) AS recordCount | 
 |  |  |         FROM | 
 |  |  |         pr_intake inta | 
 |  |  |         INNER JOIN ba_block blo ON blo.id = inta.blockId | 
 |  |  |         LEFT JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id | 
 |  |  |         WHERE rocvh.op_dt >= #{timeStart} AND rocvh.cl_dt <= #{timeStop} AND inta.deleted = 0 | 
 |  |  |         GROUP BY inta.id | 
 |  |  |         HAVING IFNULL(SUM(rocvh.cl_this_time),0) > #{value}) c | 
 |  |  |     </select> | 
 |  |  |     <!--指定时间段内用水时长超过指定值的取水口--> | 
 |  |  |     <select id="getUseWaterDurationGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount"> | 
 |  |  |         SELECT | 
 |  |  |         inta.id AS intakeId, | 
 |  |  |         inta.NAME AS intakeNum, | 
 |  |  |         blo.NAME AS blockName , | 
 |  |  |         IFNULL(SUM(rocvh.cl_this_time),0) AS recordCount | 
 |  |  |         FROM | 
 |  |  |         pr_intake inta | 
 |  |  |         INNER JOIN ba_block blo ON blo.id = inta.blockId | 
 |  |  |         LEFT JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id | 
 |  |  |         WHERE rocvh.op_dt >= #{timeStart} AND rocvh.cl_dt <= #{timeStop} AND inta.deleted = 0 | 
 |  |  |         GROUP BY inta.id | 
 |  |  |         HAVING IFNULL(SUM(rocvh.cl_this_time),0) > #{value} | 
 |  |  |         ORDER BY inta.id | 
 |  |  |         <trim prefix="limit " > | 
 |  |  |             <if test="start != null and count != null"> | 
 |  |  |                 #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} | 
 |  |  |             </if> | 
 |  |  |         </trim> | 
 |  |  |     </select> | 
 |  |  |     <!--指定时间段 有开阀 无关阀的取水口数量--> | 
 |  |  |     <select id="getHaveOpenNoCloseIntakesCount" resultType="java.lang.Long"> | 
 |  |  |         select count(*) from | 
 |  |  |             ( | 
 |  |  |         SELECT | 
 |  |  |         inta.id AS intakeId, | 
 |  |  |         inta.NAME AS intakeNum, | 
 |  |  |         blo.NAME AS blockName | 
 |  |  |         FROM | 
 |  |  |         pr_intake inta | 
 |  |  |         INNER JOIN ba_block blo ON blo.id = inta.blockId | 
 |  |  |         inner JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id | 
 |  |  |         WHERE rocvh.op_dt BETWEEN #{timeStart} AND  #{timeStop} AND rocvh.cl_dt IS NULL AND inta.deleted = 0 | 
 |  |  |         GROUP BY inta.id) c | 
 |  |  |     </select> | 
 |  |  |     <!--指定时间段 有开阀 无关阀的取水口--> | 
 |  |  |     <select id="getHaveOpenNoCloseIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntake"> | 
 |  |  |         SELECT | 
 |  |  |             inta.id AS intakeId, | 
 |  |  |             inta.NAME AS intakeNum, | 
 |  |  |             blo.NAME AS blockName | 
 |  |  |         FROM | 
 |  |  |             pr_intake inta | 
 |  |  |                 INNER JOIN ba_block blo ON blo.id = inta.blockId | 
 |  |  |                 inner JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id | 
 |  |  |         WHERE rocvh.op_dt BETWEEN #{timeStart} AND  #{timeStop} AND rocvh.cl_dt IS NULL AND inta.deleted = 0 | 
 |  |  |         GROUP BY inta.id | 
 |  |  |         ORDER BY inta.id | 
 |  |  |         <trim prefix="limit "> | 
 |  |  |             <if test="start != null and count != null"> | 
 |  |  |                 #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} | 
 |  |  |             </if> | 
 |  |  |         </trim> | 
 |  |  |     </select> | 
 |  |  |     <!--指定时间段 无开阀 有关阀的取水口数量--> | 
 |  |  |     <select id="getNoOpenHaveCloseIntakesCount" resultType="java.lang.Long"> | 
 |  |  |         select count(*) from | 
 |  |  |         ( | 
 |  |  |         SELECT | 
 |  |  |         inta.id AS intakeId, | 
 |  |  |         inta.NAME AS intakeNum, | 
 |  |  |         blo.NAME AS blockName | 
 |  |  |         FROM | 
 |  |  |         pr_intake inta | 
 |  |  |         INNER JOIN ba_block blo ON blo.id = inta.blockId | 
 |  |  |         inner JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id | 
 |  |  |         WHERE rocvh.cl_dt BETWEEN #{timeStart} AND  #{timeStop} AND rocvh.op_dt IS NULL AND inta.deleted = 0 | 
 |  |  |         GROUP BY inta.id) c | 
 |  |  |     </select> | 
 |  |  |     <!--指定时间段 无开阀 有关阀的取水口--> | 
 |  |  |     <select id="getNoOpenHaveCloseIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntake"> | 
 |  |  |         SELECT | 
 |  |  |         inta.id AS intakeId, | 
 |  |  |         inta.NAME AS intakeNum, | 
 |  |  |         blo.NAME AS blockName | 
 |  |  |         FROM | 
 |  |  |         pr_intake inta | 
 |  |  |         INNER JOIN ba_block blo ON blo.id = inta.blockId | 
 |  |  |         inner JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id | 
 |  |  |         WHERE rocvh.cl_dt BETWEEN #{timeStart} AND  #{timeStop} AND rocvh.op_dt IS NULL AND inta.deleted = 0 | 
 |  |  |         GROUP BY inta.id | 
 |  |  |         ORDER BY inta.id | 
 |  |  |         <trim prefix="limit "> | 
 |  |  |             <if test="start != null and count != null"> | 
 |  |  |                 #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} | 
 |  |  |             </if> | 
 |  |  |         </trim> | 
 |  |  |     </select> | 
 |  |  | </mapper> |