liurunyu
2024-07-25 7af935e6a092193adf309f3a2d700f049b4b63d8
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmLossDayLastMapper.xml
@@ -159,4 +159,51 @@
      loss_amount = #{lossAmount,jdbcType=DOUBLE}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <!--根据指定条件获取记录总数-->
  <select id="getRecordCount" resultType="java.lang.Long">
    select count(*)
    from rm_loss_day_last rldl
    Left join pr_intake pint on pint.id = rldl.intake_id
    <where>
      <if test="intakeName != null">
        and pint.name like CONCAT('%',#{intakeName,jdbcType=VARCHAR},'%')
      </if>
      <if test="startDt != null">
        and rldl.dt &gt;= #{startDt,jdbcType=DATE}
      </if>
      <if test="endDt != null">
        and rldl.dt &lt;= #{endDt,jdbcType=DATE}
      </if>
    </where>
  </select>
  <!--根据指定条件获取记录-->
  <select id="getLossDayLast" resultType="com.dy.pipIrrGlobal.voRm.VoLossDay">
    select
    CAST(rldl.intake_id AS char)AS intakeId,
    CAST(rldl.controller_id AS char)AS controllerId,
    pint.name as intakeName,
    rldl.rtu_addr as rtuAddr,
    rldl.dt as dt,
    rldl.dt_last as dtLast,
    rldl.dt_rtu as dtRtu,
    rldl.loss_amount as lossAmount
    from rm_loss_day_last rldl
    Left join pr_intake pint on pint.id = rldl.intake_id
    <where>
      <if test="intakeName != null">
        and pint.name like CONCAT('%',#{intakeName,jdbcType=VARCHAR},'%')
      </if>
      <if test="startDt != null">
        and rldl.dt &gt;= #{startDt,jdbcType=DATE}
      </if>
      <if test="endDt != null">
        and rldl.dt &lt;= #{endDt,jdbcType=DATE}
      </if>
    </where>
    ORDER BY rldl.id DESC
    <if test="pageCurr != null and pageSize != null">
      LIMIT ${(pageCurr-1)*pageSize}, ${pageSize}
    </if>
  </select>
</mapper>