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

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.frps.vo.FrpsServerPageReqVO;
import cn.iocoder.yudao.module.iot.dal.dataobject.frps.FrpsServerDO;
import org.apache.ibatis.annotations.Mapper;

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

    default PageResult<FrpsServerDO> selectPage(FrpsServerPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FrpsServerDO>()
                .likeIfPresent(FrpsServerDO::getFrpsName, reqVO.getFrpsName())
                .eqIfPresent(FrpsServerDO::getHostMac, reqVO.getHostMac())
                .eqIfPresent(FrpsServerDO::getHostOs, reqVO.getHostOs())
                .eqIfPresent(FrpsServerDO::getHostIp, reqVO.getHostIp())
                .eqIfPresent(FrpsServerDO::getHostPort, reqVO.getHostPort())
                .eqIfPresent(FrpsServerDO::getFrpsPath, reqVO.getFrpsPath())
                .eqIfPresent(FrpsServerDO::getFrpsState, reqVO.getFrpsState())
                .eqIfPresent(FrpsServerDO::getRemark, reqVO.getRemark())
                .eqIfPresent(FrpsServerDO::getIsEnable, reqVO.getIsEnable())
                .betweenIfPresent(FrpsServerDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FrpsServerDO::getId));
    }

}