package com.yc.ship.module.resource.dal.mysql.productRoute;

import com.yc.ship.framework.common.pojo.PageResult;
import com.yc.ship.framework.mybatis.core.mapper.BaseMapperX;
import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yc.ship.module.resource.controller.admin.productRoute.vo.ProductRoutePageReqVO;
import com.yc.ship.module.resource.dal.dataobject.productRoute.ProductRouteDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 基础产品路线 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface ProductRouteMapper extends BaseMapperX<ProductRouteDO> {

    default PageResult<ProductRouteDO> selectPage(ProductRoutePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProductRouteDO>()
                .likeIfPresent(ProductRouteDO::getName, reqVO.getName())
                .eqIfPresent(ProductRouteDO::getStartPoint, reqVO.getStartPoint())
                .likeIfPresent(ProductRouteDO::getStartPointName, reqVO.getStartPointName())
                .eqIfPresent(ProductRouteDO::getEndPoint, reqVO.getEndPoint())
                .likeIfPresent(ProductRouteDO::getEndPointName, reqVO.getEndPointName())
                .eqIfPresent(ProductRouteDO::getUseStatus, reqVO.getUseStatus())
                .betweenIfPresent(ProductRouteDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProductRouteDO::getId));
    }

}