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

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.iotmainworkorderdetails.vo.IotMainWorkOrderDetailsPageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmainworkorderdetails.IotMainWorkOrderDetailsDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 保养工单明细 Mapper
 *
 * @author ruiqi
 */
@Mapper
public interface IotMainWorkOrderDetailsMapper extends BaseMapperX<IotMainWorkOrderDetailsDO> {

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

}