|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--获取累计流量超过指定值的取水口--> | 
|---|
|  |  |  | <select id="getLargeFlowIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoCumulativeFlow"> | 
|---|
|  |  |  | SELECT inta.id                                  AS intakeId, | 
|---|
|  |  |  | inta.name                                AS intakeNum, | 
|---|
|  |  |  | blo.name                                 AS blockName, | 
|---|
|  |  |  | CAST(hou.total_amount AS DECIMAL(10, 2)) AS cumulativeFlow, | 
|---|
|  |  |  | hou.dt                                   AS getDate | 
|---|
|  |  |  | SELECT inta.id            AS intakeId, | 
|---|
|  |  |  | inta.name          AS intakeNum, | 
|---|
|  |  |  | inta.lng           AS lng, | 
|---|
|  |  |  | inta.lat           AS lat, | 
|---|
|  |  |  | blo.name           AS blockName, | 
|---|
|  |  |  | hou.total_amount   AS cumulativeFlow, | 
|---|
|  |  |  | hou.dt             AS getDate | 
|---|
|  |  |  | FROM pr_intake inta | 
|---|
|  |  |  | INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id | 
|---|
|  |  |  | INNER JOIN ba_block blo ON blo.id = inta.blockId | 
|---|
|  |  |  | 
|---|
|  |  |  | <select id="getSmallFlowIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoCumulativeFlow"> | 
|---|
|  |  |  | SELECT inta.id   AS intakeId, | 
|---|
|  |  |  | inta.name AS intakeNum, | 
|---|
|  |  |  | inta.lng  AS lng, | 
|---|
|  |  |  | inta.lat  AS lat, | 
|---|
|  |  |  | blo.name  AS blockName, | 
|---|
|  |  |  | <!--    FORMAT(hou.total_amount,2) AS cumulativeFlow,--> | 
|---|
|  |  |  | CAST(hou.total_amount AS DECIMAL(10, 2)) AS cumulativeFlow, | 
|---|
|  |  |  | hou.dt                                   AS getDate | 
|---|
|  |  |  | hou.total_amount AS cumulativeFlow, | 
|---|
|  |  |  | hou.dt    AS getDate | 
|---|
|  |  |  | FROM pr_intake inta | 
|---|
|  |  |  | INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id | 
|---|
|  |  |  | INNER JOIN ba_block blo ON blo.id = inta.blockId | 
|---|
|  |  |  | 
|---|
|  |  |  | <select id="getUnderVoltIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoBatteryVolt"> | 
|---|
|  |  |  | SELECT inta.id          AS intakeId, | 
|---|
|  |  |  | inta.name        AS intakeNum, | 
|---|
|  |  |  | inta.lng         AS lng, | 
|---|
|  |  |  | inta.lat         AS lat, | 
|---|
|  |  |  | blo.name         AS blockName, | 
|---|
|  |  |  | hou.battery_volt AS batteryVolt, | 
|---|
|  |  |  | hou.dt           AS getDate | 
|---|
|  |  |  | 
|---|
|  |  |  | <select id="getSpecifiedSignalIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoSignalIntensity"> | 
|---|
|  |  |  | SELECT inta.id          AS intakeId, | 
|---|
|  |  |  | inta.name        AS intakeNum, | 
|---|
|  |  |  | inta.lng         AS lng, | 
|---|
|  |  |  | inta.lat         AS lat, | 
|---|
|  |  |  | blo.name         AS blockName, | 
|---|
|  |  |  | hou.signal_value AS signValue, | 
|---|
|  |  |  | hou.dt           AS getDate | 
|---|
|  |  |  | 
|---|
|  |  |  | <!--获取最近未报数的取水口数量--> | 
|---|
|  |  |  | <select id="getUnReportedIntakesCount" resultType="java.lang.Long"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | count(*) | 
|---|
|  |  |  | FROM  pr_intake pit | 
|---|
|  |  |  | LEFT JOIN `rm_on_hour_report_last` rohrl ON pit.id = rohrl.intake_id | 
|---|
|  |  |  | LEFT JOIN pr_controller pct ON pit.id = pct.intakeId | 
|---|
|  |  |  | WHERE  rohrl.id is NULL | 
|---|
|  |  |  | count(*) | 
|---|
|  |  |  | FROM pr_intake pit | 
|---|
|  |  |  | LEFT JOIN `rm_on_hour_report_last` rohrl | 
|---|
|  |  |  | ON ( | 
|---|
|  |  |  | pit.id = rohrl.intake_id | 
|---|
|  |  |  | <if test="timeStart != null and timeStart != '' "> | 
|---|
|  |  |  | OR rohrl.rtu_dt  < #{timeStart} | 
|---|
|  |  |  | AND rohrl.dt  > #{timeStart} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <!--        <if test="timeStop != null and timeStop != '' ">--> | 
|---|
|  |  |  | <!--            OR rohrl.rtu_dt > #{timeStop}--> | 
|---|
|  |  |  | <!--        </if>--> | 
|---|
|  |  |  | ORDER BY rtu_dt ASC | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | LEFT JOIN ba_block bbl ON bbl.id = pit.blockId | 
|---|
|  |  |  | LEFT JOIN pr_controller pct ON pit.id = pct.intakeId | 
|---|
|  |  |  | WHERE rohrl.id is NULL | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <!--获取最近未报数的取水口--> | 
|---|
|  |  |  | <select id="getUnReportedIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeUnReported"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | pit.`name` intakeNum, | 
|---|
|  |  |  | pct.rtuAddr, | 
|---|
|  |  |  | rohrl.rtu_dt rtuDt | 
|---|
|  |  |  | pit.id      AS intakeId, | 
|---|
|  |  |  | pit.`name`  AS intakeNum, | 
|---|
|  |  |  | pit.lng     AS lng, | 
|---|
|  |  |  | pit.lat     AS lat, | 
|---|
|  |  |  | bbl.name    AS blockName, | 
|---|
|  |  |  | pct.rtuAddr AS rtuAddr | 
|---|
|  |  |  | FROM  pr_intake pit | 
|---|
|  |  |  | LEFT JOIN `rm_on_hour_report_last` rohrl ON pit.id = rohrl.intake_id | 
|---|
|  |  |  | LEFT JOIN `rm_on_hour_report_last` rohrl | 
|---|
|  |  |  | ON ( | 
|---|
|  |  |  | pit.id = rohrl.intake_id | 
|---|
|  |  |  | <if test="timeStart != null and timeStart != '' "> | 
|---|
|  |  |  | AND rohrl.dt  > #{timeStart} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | LEFT JOIN ba_block bbl ON bbl.id = pit.blockId | 
|---|
|  |  |  | LEFT JOIN pr_controller pct ON pit.id = pct.intakeId | 
|---|
|  |  |  | WHERE  rohrl.id is NULL | 
|---|
|  |  |  | <if test="timeStart != null"> | 
|---|
|  |  |  | OR rohrl.rtu_dt  < #{timeStart} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <!--        <if test="timeStop != null">--> | 
|---|
|  |  |  | <!--            OR rohrl.rtu_dt > #{timeStop}--> | 
|---|
|  |  |  | <!--        </if>--> | 
|---|
|  |  |  | ORDER BY rtu_dt ASC | 
|---|
|  |  |  | ORDER BY pit.id DESC | 
|---|
|  |  |  | <trim prefix="limit "> | 
|---|
|  |  |  | <if test="start != null and count != null"> | 
|---|
|  |  |  | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} | 
|---|