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

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.VehicleGuidePageReqVO;
import com.xindazhou.vehicle.dal.dataobject.guide.VehicleGuideDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 使用指南与支持 Mapper
 *
 * @author xindazhou
 */
@Mapper
public interface VehicleGuideMapper extends BaseMapperX<VehicleGuideDO> {

    default PageResult<VehicleGuideDO> selectPage(VehicleGuidePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VehicleGuideDO>()
                .likeIfPresent(VehicleGuideDO::getTitle, reqVO.getTitle())
                .eqIfPresent(VehicleGuideDO::getCategory, reqVO.getCategory())
                .eqIfPresent(VehicleGuideDO::getStatus, reqVO.getStatus())
                .eqIfPresent(VehicleGuideDO::getIsDisplay, reqVO.getIsDisplay())
                .betweenIfPresent(VehicleGuideDO::getOnShelfTime, reqVO.getOnShelfTime())
                .orderByDesc(VehicleGuideDO::getId));
    }

}
