| | |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <!--获取指定时间段内用水量超过指定值的农户数量--> |
| | | <select id="getLargeWaterConsumptionClientsCount" resultType="java.lang.Long"> |
| | | SELECT COUNT(*) AS recordCount |
| | | FROM se_client cli |
| | | WHERE (SELECT SUM(his.cl_this_amount) |
| | | FROM rm_open_close_valve_history his |
| | | WHERE his.client_id = cli.id |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{waterConsumption} |
| | | </select> |
| | | |
| | | <!--获取指定时间段内用水量超过指定值的农户--> |
| | | <select id="getLargeWaterConsumptionClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient"> |
| | | SELECT cli.id AS clientId, |
| | | cli.name AS clientName, |
| | | cli.clientNum, |
| | | CONCAT(cli.districtTitle, cli.address) AS address, |
| | | cli.phone, |
| | | cli.idCard |
| | | FROM se_client cli |
| | | WHERE (SELECT SUM(his.cl_this_amount) |
| | | FROM rm_open_close_valve_history his |
| | | WHERE his.client_id = cli.id |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{waterConsumption} |
| | | ORDER BY cli.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="getLargeAmountSpentClientsCount" resultType="java.lang.Long"> |
| | | SELECT COUNT(*) AS recordCount |
| | | FROM se_client cli |
| | | WHERE (SELECT SUM(his.cl_this_money) |
| | | FROM rm_open_close_valve_history his |
| | | WHERE his.client_id = cli.id |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{amountSpent} |
| | | </select> |
| | | <!--获取指定时间段内消费金额超过指定值的农户--> |
| | | <select id="getLargeAmountSpentClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient"> |
| | | SELECT cli.id AS clientId, |
| | | cli.name AS clientName, |
| | | cli.clientNum, |
| | | CONCAT(cli.districtTitle, cli.address) AS address, |
| | | cli.phone, |
| | | cli.idCard |
| | | FROM se_client cli |
| | | WHERE (SELECT SUM(his.cl_this_money) |
| | | FROM rm_open_close_valve_history his |
| | | WHERE his.client_id = cli.id |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{amountSpent} |
| | | ORDER BY cli.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="getLargeWaterDurationClientsCount" resultType="java.lang.Long"> |
| | | SELECT COUNT(*) AS recordCount |
| | | FROM se_client cli |
| | | WHERE (SELECT SUM(his.cl_this_time) |
| | | FROM rm_open_close_valve_history his |
| | | WHERE his.client_id = cli.id |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{waterDuration} |
| | | </select> |
| | | |
| | | <!--获取指定时间段内用水时长超过指定值的农户--> |
| | | <select id="getLargeWaterDurationClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient"> |
| | | SELECT cli.id AS clientId, |
| | | cli.name AS clientName, |
| | | cli.clientNum, |
| | | CONCAT(cli.districtTitle, cli.address) AS address, |
| | | cli.phone, |
| | | cli.idCard |
| | | FROM se_client cli |
| | | WHERE (SELECT SUM(his.cl_this_time) |
| | | FROM rm_open_close_valve_history his |
| | | WHERE his.client_id = cli.id |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{waterDuration} |
| | | ORDER BY cli.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="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> |
| | | </mapper> |