package cn.iocoder.yudao.module.iot.dal.mysql.frpc;

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.iot.controller.admin.frpc.vo.FrpcProxyServerPageReqVO;
import cn.iocoder.yudao.module.iot.dal.dataobject.frpc.FrpcProxyServerDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 代理服务 Mapper
 *
 * @author 内蒙必硕
 */
@Mapper
public interface FrpcProxyServerMapper extends BaseMapperX<FrpcProxyServerDO> {

    default PageResult<FrpcProxyServerDO> selectPage(FrpcProxyServerPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FrpcProxyServerDO>()
                .likeIfPresent(FrpcProxyServerDO::getFrpcName, reqVO.getFrpcName())
                .eqIfPresent(FrpcProxyServerDO::getLocalIp, reqVO.getLocalIp())
                .eqIfPresent(FrpcProxyServerDO::getLocalPort, reqVO.getLocalPort())
                .eqIfPresent(FrpcProxyServerDO::getSuffixPath, reqVO.getSuffixPath())
                .eqIfPresent(FrpcProxyServerDO::getLocalStatus, reqVO.getLocalStatus())
                .eqIfPresent(FrpcProxyServerDO::getFrpsId, reqVO.getFrpsId())
                .eqIfPresent(FrpcProxyServerDO::getProxyPort, reqVO.getProxyPort())
                .eqIfPresent(FrpcProxyServerDO::getProxyAddress, reqVO.getProxyAddress())
                .eqIfPresent(FrpcProxyServerDO::getProxyStatus, reqVO.getProxyStatus())
                .eqIfPresent(FrpcProxyServerDO::getRemark, reqVO.getRemark())
                .eqIfPresent(FrpcProxyServerDO::getIsEnable, reqVO.getIsEnable())
                .betweenIfPresent(FrpcProxyServerDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FrpcProxyServerDO::getId));
    }

}