package cn.iocoder.yudao.module.mes.dal.mysql.energydevice;

import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.mes.controller.admin.energydevice.vo.EnergyDeviceReportPageReqVO;
import cn.iocoder.yudao.module.mes.dal.dataobject.energydevice.EnergyDeviceReportDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 抄表记录 Mapper
 *
 * @author 内蒙必硕
 */
@Mapper
public interface EnergyDeviceReportMapper extends BaseMapperX<EnergyDeviceReportDO> {

    default PageResult<EnergyDeviceReportDO> selectPage(EnergyDeviceReportPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EnergyDeviceReportDO>()
                .eqIfPresent(EnergyDeviceReportDO::getDeviceId, reqVO.getDeviceId())
                .betweenIfPresent(EnergyDeviceReportDO::getStartTime, reqVO.getStartTime())
                .orderByDesc(EnergyDeviceReportDO::getId));
    }
    default PageResult<EnergyDeviceReportDO> selectPage(PageParam reqVO, Long deviceId) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EnergyDeviceReportDO>()
                .eq(EnergyDeviceReportDO::getDeviceId, deviceId)
                .orderByDesc(EnergyDeviceReportDO::getId));
    }

}