Administrator
2024-08-01 3b32adb6b7b8d40f85e84f8b1a775f2ec1df88af
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportHistoryMapper.xml
@@ -255,4 +255,93 @@
    </trim>
  </select>
  <!--获取指定时间段内未上线取水口数量-->
  <select id="getNotOnlineIntakesCount" resultType="java.lang.Long">
    SELECT
        COUNT(*) AS recordCount
    FROM pr_intake inta
        LEFT JOIN (SELECT * FROM rm_on_hour_report_history WHERE dt BETWEEN #{timeStart} AND #{timeStop}) his ON his.intake_id = inta.id
        INNER JOIN ba_block blo ON blo.id = inta.blockId
    WHERE his.intake_id IS NULL AND inta.deleted = 0
  </select>
  <!--获取指定时间段内未上线的取水口-->
  <select id="getNotOnlineIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntake">
    SELECT
      inta.id AS intakeId,
      inta.name AS intakeNum,
      blo.name AS blockName
    FROM pr_intake inta
           LEFT JOIN (SELECT * FROM rm_on_hour_report_history WHERE dt BETWEEN #{timeStart} AND #{timeStop}) his ON his.intake_id = inta.id
           INNER JOIN ba_block blo ON blo.id = inta.blockId
    WHERE his.intake_id IS NULL AND inta.deleted = 0
    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="getLargeFlowIntakesCount" resultType="java.lang.Long">
    SELECT
        COUNT(*) AS recordCount
    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
    WHERE inta.deleted = 0 AND hou.total_amount > #{totalAmount}
  </select>
  <!--获取累计流量超过指定值的取水口-->
  <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
    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
    WHERE inta.deleted = 0 AND hou.total_amount > #{totalAmount}
    ORDER BY hou.dt
    <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="getSmallFlowIntakesCount" resultType="java.lang.Long">
    SELECT
        COUNT(*) AS recordCount
    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
    WHERE inta.deleted = 0 AND hou.total_amount &lt; #{totalAmount}
  </select>
  <!--获取累计流量低于指定值的取水口-->
  <select id="getSmallFlowIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoCumulativeFlow">
    SELECT
        inta.id AS intakeId,
        inta.name AS intakeNum,
        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
    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
    WHERE inta.deleted = 0 AND hou.total_amount &lt; #{totalAmount}
    ORDER BY hou.dt
    <trim prefix="limit " >
      <if test="start != null and count != null">
        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
      </if>
    </trim>
  </select>
</mapper>