package cn.iocoder.yudao.module.pms.dal.mysql.yanfan.sip.device;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.vo.YfSipDevicePageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.YfSipDeviceDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * yf监控设备 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface YfSipDeviceMapper extends BaseMapperX<YfSipDeviceDO> {
    int deleteSipDeviceByByDeviceSipId(String deviceSipId);
    int updateSipDeviceStatus(YfSipDeviceDO sipDevice);
    @TenantIgnore
    YfSipDeviceDO selectSipDeviceBySipId(String sipId);
    default PageResult<YfSipDeviceDO> selectPage(YfSipDevicePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<YfSipDeviceDO>()
                .eqIfPresent(YfSipDeviceDO::getProductId, reqVO.getProductId())
                .likeIfPresent(YfSipDeviceDO::getProductName, reqVO.getProductName())
                .eqIfPresent(YfSipDeviceDO::getDeviceSipId, reqVO.getDeviceSipId())
                .likeIfPresent(YfSipDeviceDO::getDeviceName, reqVO.getDeviceName())
                .eqIfPresent(YfSipDeviceDO::getManufacturer, reqVO.getManufacturer())
                .eqIfPresent(YfSipDeviceDO::getModel, reqVO.getModel())
                .eqIfPresent(YfSipDeviceDO::getFirmware, reqVO.getFirmware())
                .eqIfPresent(YfSipDeviceDO::getTransport, reqVO.getTransport())
                .eqIfPresent(YfSipDeviceDO::getStreamMode, reqVO.getStreamMode())
                .eqIfPresent(YfSipDeviceDO::getOnline, reqVO.getOnline())
                .betweenIfPresent(YfSipDeviceDO::getRegisterTime, reqVO.getRegisterTime())
                .betweenIfPresent(YfSipDeviceDO::getLastConnectTime, reqVO.getLastConnectTime())
                .betweenIfPresent(YfSipDeviceDO::getActiveTime, reqVO.getActiveTime())
                .eqIfPresent(YfSipDeviceDO::getIp, reqVO.getIp())
                .eqIfPresent(YfSipDeviceDO::getPort, reqVO.getPort())
                .eqIfPresent(YfSipDeviceDO::getHostAddress, reqVO.getHostAddress())
                .eqIfPresent(YfSipDeviceDO::getDelFlag, reqVO.getDelFlag())
                .eqIfPresent(YfSipDeviceDO::getCreateBy, reqVO.getCreateBy())
                .eqIfPresent(YfSipDeviceDO::getUpdateBy, reqVO.getUpdateBy())
                .eqIfPresent(YfSipDeviceDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(YfSipDeviceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(YfSipDeviceDO::getDeviceId));
    }

}
