package cn.iocoder.yudao.module.pms.dal.mysql.iotdailyreportfuel;

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.pms.controller.admin.iotdailyreportfuel.vo.IotDailyReportFuelPageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotdailyreportfuel.IotDailyReportFuelDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 日报-油耗 Mapper
 *
 * @author ruiqi
 */
@Mapper
public interface IotDailyReportFuelMapper extends BaseMapperX<IotDailyReportFuelDO> {

    default PageResult<IotDailyReportFuelDO> selectPage(IotDailyReportFuelPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotDailyReportFuelDO>()
                .eqIfPresent(IotDailyReportFuelDO::getType, reqVO.getType())
                .eqIfPresent(IotDailyReportFuelDO::getReportId, reqVO.getReportId())
                .eqIfPresent(IotDailyReportFuelDO::getDeviceId, reqVO.getDeviceId())
                .eqIfPresent(IotDailyReportFuelDO::getDeviceCode, reqVO.getDeviceCode())
                .eqIfPresent(IotDailyReportFuelDO::getYfDeviceCode, reqVO.getYfDeviceCode())
                .likeIfPresent(IotDailyReportFuelDO::getDeviceName, reqVO.getDeviceName())
                .eqIfPresent(IotDailyReportFuelDO::getCarId, reqVO.getCarId())
                .eqIfPresent(IotDailyReportFuelDO::getZhbdFuel, reqVO.getZhbdFuel())
                .eqIfPresent(IotDailyReportFuelDO::getCustomFuel, reqVO.getCustomFuel())
                .betweenIfPresent(IotDailyReportFuelDO::getQueryDate, reqVO.getQueryDate())
                .eqIfPresent(IotDailyReportFuelDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(IotDailyReportFuelDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IotDailyReportFuelDO::getId));
    }

    default List<IotDailyReportFuelDO> selectList(IotDailyReportFuelPageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<IotDailyReportFuelDO>()
                .eqIfPresent(IotDailyReportFuelDO::getType, reqVO.getType())
                .eqIfPresent(IotDailyReportFuelDO::getReportId, reqVO.getReportId())
                .inIfPresent(IotDailyReportFuelDO::getReportId, reqVO.getReportIds())
                .eqIfPresent(IotDailyReportFuelDO::getDeviceId, reqVO.getDeviceId())
                .eqIfPresent(IotDailyReportFuelDO::getDeviceCode, reqVO.getDeviceCode())
                .eqIfPresent(IotDailyReportFuelDO::getYfDeviceCode, reqVO.getYfDeviceCode())
                .likeIfPresent(IotDailyReportFuelDO::getDeviceName, reqVO.getDeviceName())
                .eqIfPresent(IotDailyReportFuelDO::getCarId, reqVO.getCarId())
                .eqIfPresent(IotDailyReportFuelDO::getZhbdFuel, reqVO.getZhbdFuel())
                .eqIfPresent(IotDailyReportFuelDO::getCustomFuel, reqVO.getCustomFuel())
                .betweenIfPresent(IotDailyReportFuelDO::getQueryDate, reqVO.getQueryDate())
                .eqIfPresent(IotDailyReportFuelDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(IotDailyReportFuelDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IotDailyReportFuelDO::getId));
    }

}