package cn.iocoder.yudao.module.asset.dal.mysql.prepare;

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.asset.controller.admin.prepare.vo.VehiclePreparePageReqVO;
import cn.iocoder.yudao.module.asset.dal.dataobject.prepare.VehiclePrepareDO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface VehiclePrepareMapper extends BaseMapperX<VehiclePrepareDO> {

    default PageResult<VehiclePrepareDO> selectPage(VehiclePreparePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VehiclePrepareDO>()
                .likeIfPresent(VehiclePrepareDO::getPlateNo, reqVO.getPlateNo())
                .likeIfPresent(VehiclePrepareDO::getVin, reqVO.getVin())
                .likeIfPresent(VehiclePrepareDO::getContractCode, reqVO.getContractCode())
                .eqIfPresent(VehiclePrepareDO::getVehicleType, reqVO.getVehicleType())
                .likeIfPresent(VehiclePrepareDO::getBrand, reqVO.getBrand())
                .likeIfPresent(VehiclePrepareDO::getParkingLot, reqVO.getParkingLot())
                .eqIfPresent(VehiclePrepareDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(VehiclePrepareDO::getCompleteTime, reqVO.getCompleteTime())
                .betweenIfPresent(VehiclePrepareDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(VehiclePrepareDO::getId));
    }

}
