Administrator
2024-07-25 86719a90118b4b458ae593b53457f23c11ee8d44
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmIntakeAmountDayMapper.xml
@@ -155,4 +155,59 @@
      rtu_dt_last = #{rtuDtLast,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <!--根据指定条件获取记录总数-->
  <select id="getRecordCount" resultType="java.lang.Long">
    select count(*)
    from rm_intake_amount_day riad
    Left join pr_intake pint on pint.id = riad.intake_id
    <where>
      <if test="intakeName != null">
        and pint.name like CONCAT('%',#{intakeName,jdbcType=VARCHAR},'%')
      </if>
      <if test="startDt != null">
        and riad.dt &gt;= #{startDt,jdbcType=DATE}
      </if>
      <if test="endDt != null">
        and riad.dt &lt;= #{endDt,jdbcType=DATE}
      </if>
    </where>
    </select>
  <!--根据指定条件获取记录-->
  <select id="getIntakeAmountDayHistory" resultType="com.dy.pipIrrGlobal.voRm.VoIntakeAmountDay">
    select
    CAST(riad.intake_id AS char)AS intakeId,
    pint.name as intakeName,
    riad.dt as dt,
    riad.amount as amount,
    riad.dt_last as dtLast,
    riad.rtu_addr_last as rtuAddrLast,
    CAST(riad.controller_id_last AS char)AS controllerIdLast,
    riad.total_amount_last as totalAmountLast,
    riad.rtu_dt_last as rtuDtLast
    from rm_intake_amount_day riad
    Left join pr_intake pint on pint.id = riad.intake_id
    <where>
      <if test="intakeName != null">
        and pint.name like CONCAT('%',#{intakeName,jdbcType=VARCHAR},'%')
      </if>
      <if test="startDt != null">
        and riad.dt &gt;= #{startDt,jdbcType=DATE}
      </if>
      <if test="endDt != null">
        and riad.dt &lt;= #{endDt,jdbcType=DATE}
      </if>
    </where>
    ORDER BY riad.id DESC
    <if test="pageCurr != null and pageSize != null">
      LIMIT ${(pageCurr-1)*pageSize}, ${pageSize}
    </if>
  </select>
  <select id="statisticsByIntake" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAmountStatistics">
    select intake_id, sum(amount) amount
    from rm_intake_amount_day
    where id <![CDATA[>=]]> #{startId, jdbcType=BIGINT} and id <![CDATA[<]]> #{endId, jdbcType=BIGINT}
    group by intake_id
  </select>
</mapper>