package cn.iocoder.yudao.module.energy.dal.mysql.record;

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.energy.controller.admin.record.vo.HydrogenRecordPageReqVO;
import cn.iocoder.yudao.module.energy.dal.dataobject.record.EnergyHydrogenRecordDO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface EnergyHydrogenRecordMapper extends BaseMapperX<EnergyHydrogenRecordDO> {

    default PageResult<EnergyHydrogenRecordDO> selectPage(HydrogenRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EnergyHydrogenRecordDO>()
                .eqIfPresent(EnergyHydrogenRecordDO::getStationId, reqVO.getStationId())
                .likeIfPresent(EnergyHydrogenRecordDO::getPlateNumber, reqVO.getPlateNumber())
                .eqIfPresent(EnergyHydrogenRecordDO::getMatchStatus, reqVO.getMatchStatus())
                .eqIfPresent(EnergyHydrogenRecordDO::getSourceType, reqVO.getSourceType())
                .betweenIfPresent(EnergyHydrogenRecordDO::getHydrogenDate, reqVO.getHydrogenDate())
                .orderByDesc(EnergyHydrogenRecordDO::getId));
    }

}
