package com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database;

import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.tunnelHole.TunnelHolePageReqVO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.TunnelHoleV2DO;
import com.cico.nest.lcdp.framework.common.pojo.PageResult;
import com.cico.nest.lcdp.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cico.nest.lcdp.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;

/**
 * 隧道设施上下行洞 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface TunnelHoleMapper extends BaseMapperX<TunnelHoleV2DO> {

    default PageResult<TunnelHoleV2DO> selectPage(TunnelHolePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TunnelHoleV2DO>()
                .likeIfPresent(TunnelHoleV2DO::getHoleName, reqVO.getHoleName())
                .eqIfPresent(TunnelHoleV2DO::getTunnelId, reqVO.getTunnelId())
                .eqIfPresent(TunnelHoleV2DO::getDirectionUpdown, reqVO.getDirectionUpdown())
                .likeIfPresent(TunnelHoleV2DO::getDirectionName, reqVO.getDirectionName())
                .eqIfPresent(TunnelHoleV2DO::getMileStart, reqVO.getMileStart())
                .eqIfPresent(TunnelHoleV2DO::getMileEnd, reqVO.getMileEnd())
                .eqIfPresent(TunnelHoleV2DO::getLength, reqVO.getLength())
                .eqIfPresent(TunnelHoleV2DO::getWidth, reqVO.getWidth())
                .eqIfPresent(TunnelHoleV2DO::getHeight, reqVO.getHeight())
                .eqIfPresent(TunnelHoleV2DO::getLimitHeight, reqVO.getLimitHeight())
                .eqIfPresent(TunnelHoleV2DO::getLaneNum, reqVO.getLaneNum())
                .eqIfPresent(TunnelHoleV2DO::getEmergencyNum, reqVO.getEmergencyNum())
                .eqIfPresent(TunnelHoleV2DO::getOrderNo, reqVO.getOrderNo())
                .eqIfPresent(TunnelHoleV2DO::getSfHoleId, reqVO.getSfHoleId())
                .betweenIfPresent(TunnelHoleV2DO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TunnelHoleV2DO::getId));
    }

}
