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

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.pms.controller.admin.maintenance.vo.IotMaintenanceDetailsPageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.maintenance.IotMaintenanceDetailsDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 保养计划明细 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface IotMaintenanceDetailsMapper extends BaseMapperX<IotMaintenanceDetailsDO> {

    default PageResult<IotMaintenanceDetailsDO> selectPage(IotMaintenanceDetailsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotMaintenanceDetailsDO>()
                .eqIfPresent(IotMaintenanceDetailsDO::getPlanId, reqVO.getPlanId())
                .eqIfPresent(IotMaintenanceDetailsDO::getDeviceId, reqVO.getDeviceId())
                .eqIfPresent(IotMaintenanceDetailsDO::getDeviceAssetNumber, reqVO.getDeviceAssetNumber())
                .likeIfPresent(IotMaintenanceDetailsDO::getDeviceName, reqVO.getDeviceName())
                .eqIfPresent(IotMaintenanceDetailsDO::getDeviceCategory, reqVO.getDeviceCategory())
                .eqIfPresent(IotMaintenanceDetailsDO::getDeviceBrand, reqVO.getDeviceBrand())
                .eqIfPresent(IotMaintenanceDetailsDO::getRunningKilometers, reqVO.getRunningKilometers())
                .betweenIfPresent(IotMaintenanceDetailsDO::getRunningTime, reqVO.getRunningTime())
                .betweenIfPresent(IotMaintenanceDetailsDO::getNaturalDate, reqVO.getNaturalDate())
                .eqIfPresent(IotMaintenanceDetailsDO::getRemark, reqVO.getRemark())
                .eqIfPresent(IotMaintenanceDetailsDO::getSort, reqVO.getSort())
                .eqIfPresent(IotMaintenanceDetailsDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(IotMaintenanceDetailsDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IotMaintenanceDetailsDO::getId));
    }

}
