package com.klp.ems.mapper; import com.klp.ems.domain.EmsEnergyConsumption; import com.klp.ems.domain.bo.TimeRangeWithMetersBo; import com.klp.ems.domain.bo.EmsEnergyConsumptionBo; import com.klp.ems.domain.vo.EmsEnergyConsumptionVo; import com.klp.common.core.mapper.BaseMapperPlus; import com.klp.ems.domain.vo.SummaryDailyVo; import com.klp.ems.domain.vo.SummaryMonthlyVo; import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; /** * 能耗记录Mapper接口 * * @author Joshi * @date 2025-09-28 */ public interface EmsEnergyConsumptionMapper extends BaseMapperPlus { List selectDailySummary(@Param("startDate") String startDate, @Param("endDate") String endDate); List selectMonthlySummary(@Param("year") String year); /** * 统计某个时间区间的用能合计 */ Double sumConsumptionBetween(String startTime, String endTime); /** * 统计某个时间区间、指定设备集合的用能合计 */ Double sumConsumptionBetweenWithMeters(TimeRangeWithMetersBo range); List selectDailySummaryWithMeters(TimeRangeWithMetersBo range); List selectMonthlySummaryWithMeters(TimeRangeWithMetersBo range); EmsEnergyConsumption selectLatestBefore(@Param("meterId") Long meterId, @Param("endTime") String endTime); List selectOverlapRange(@Param("meterId") Long meterId, @Param("startTime") String startTime, @Param("endTime") String endTime); EmsEnergyConsumption selectCoveringRange(@Param("meterId") Long meterId, @Param("startTime") String startTime, @Param("endTime") String endTime); /** * 查询指定计量表最近的两条抄表记录(按endTime倒序) */ List selectLatestTwoReadings(@Param("meterId") Long meterId); /** * 获取能耗统计信息(用SQL聚合函数计算) */ Map getStatistics(EmsEnergyConsumptionBo bo); /** * 查询最近一次抄表的时间范围 */ com.klp.ems.domain.vo.LatestMeterReadTimeVo selectLatestMeterReadTime(); }