package com.xindazhou.vehicle.dal.mysql.gallery;

import com.xindazhou.framework.common.pojo.PageResult;
import com.xindazhou.framework.mybatis.core.mapper.BaseMapperX;
import com.xindazhou.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.xindazhou.vehicle.controller.admin.vehicle.vo.VehicleImagePageReqVO;
import com.xindazhou.vehicle.dal.dataobject.gallery.VehicleImageDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 车辆图片 Mapper
 *
 * @author xindazhou
 */
@Mapper
public interface VehicleImageMapper extends BaseMapperX<VehicleImageDO> {

    default PageResult<VehicleImageDO> selectPage(VehicleImagePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VehicleImageDO>()
                .eqIfPresent(VehicleImageDO::getCategory, reqVO.getCategory())
                .eqIfPresent(VehicleImageDO::getVehicleId, reqVO.getVehicleId())
                .eqIfPresent(VehicleImageDO::getGalleryId, reqVO.getGalleryId())
                .orderByDesc(VehicleImageDO::getId));
    }

}

