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

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.module.pms.controller.admin.yanfan.sip.device.channel.vo.YfSipDeviceChannelPageReqVO;
import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.channel.vo.YfSipDeviceChannelRespVO;
import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.channel.vo.YfSipDeviceChannelSaveReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.channel.YfSipDeviceChannelDO;
import liquibase.pro.packaged.Y;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * yf监控设备通道信息 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface YfSipDeviceChannelMapper extends BaseMapperX<YfSipDeviceChannelDO> {
    int deleteSipDeviceChannelByDeviceId(String deviceSipId);
    List<YfSipDeviceChannelDO> selectChannelByCivilCode(@Param("deviceSipId") String deviceSipId, @Param("parentId") String parentId);
    List<YfSipDeviceChannelDO> selectSipDeviceChannelByDeviceSipId(String deviceSipId);
    List<YfSipDeviceChannelDO> selectChannelWithoutCiviCode(String deviceId);
    List<YfSipDeviceChannelDO> selectChannelWithCivilCodeAndLength(@Param("deviceSipId") String deviceSipId, @Param("parentId") String parentId, @Param("length")Integer length);
    Integer getChannelMinLength(String deviceSipId);
    int updateSipDeviceChannel(YfSipDeviceChannelDO sipDeviceChannel);
    List<YfSipDeviceChannelRespVO> selectSipDeviceChannelList(YfSipDeviceChannelDO sipDeviceChannel);
    YfSipDeviceChannelDO selectSipDeviceChannelByChannelSipId(String channelSipId);
    default PageResult<YfSipDeviceChannelDO> selectPage(YfSipDeviceChannelPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<YfSipDeviceChannelDO>()
                .likeIfPresent(YfSipDeviceChannelDO::getTenantName, reqVO.getTenantName())
                .eqIfPresent(YfSipDeviceChannelDO::getProductId, reqVO.getProductId())
                .likeIfPresent(YfSipDeviceChannelDO::getProductName, reqVO.getProductName())
                .eqIfPresent(YfSipDeviceChannelDO::getUserId, reqVO.getUserId())
                .likeIfPresent(YfSipDeviceChannelDO::getUserName, reqVO.getUserName())
                .eqIfPresent(YfSipDeviceChannelDO::getChannelSipId, reqVO.getChannelSipId())
                .likeIfPresent(YfSipDeviceChannelDO::getChannelName, reqVO.getChannelName())
                .betweenIfPresent(YfSipDeviceChannelDO::getRegisterTime, reqVO.getRegisterTime())
                .eqIfPresent(YfSipDeviceChannelDO::getDeviceType, reqVO.getDeviceType())
                .eqIfPresent(YfSipDeviceChannelDO::getChannelType, reqVO.getChannelType())
                .eqIfPresent(YfSipDeviceChannelDO::getCityCode, reqVO.getCityCode())
                .eqIfPresent(YfSipDeviceChannelDO::getCivilCode, reqVO.getCivilCode())
                .eqIfPresent(YfSipDeviceChannelDO::getManufacture, reqVO.getManufacture())
                .eqIfPresent(YfSipDeviceChannelDO::getModel, reqVO.getModel())
                .eqIfPresent(YfSipDeviceChannelDO::getOwner, reqVO.getOwner())
                .eqIfPresent(YfSipDeviceChannelDO::getBlock, reqVO.getBlock())
                .eqIfPresent(YfSipDeviceChannelDO::getAddress, reqVO.getAddress())
                .eqIfPresent(YfSipDeviceChannelDO::getParentId, reqVO.getParentId())
                .eqIfPresent(YfSipDeviceChannelDO::getIpAddress, reqVO.getIpAddress())
                .eqIfPresent(YfSipDeviceChannelDO::getPort, reqVO.getPort())
                .eqIfPresent(YfSipDeviceChannelDO::getPassword, reqVO.getPassword())
                .eqIfPresent(YfSipDeviceChannelDO::getPtzType, reqVO.getPtzType())
                .eqIfPresent(YfSipDeviceChannelDO::getPtzTypeText, reqVO.getPtzTypeText())
                .eqIfPresent(YfSipDeviceChannelDO::getStatus, reqVO.getStatus())
                .eqIfPresent(YfSipDeviceChannelDO::getLongitude, reqVO.getLongitude())
                .eqIfPresent(YfSipDeviceChannelDO::getLatitude, reqVO.getLatitude())
                .eqIfPresent(YfSipDeviceChannelDO::getStreamId, reqVO.getStreamId())
                .eqIfPresent(YfSipDeviceChannelDO::getSubCount, reqVO.getSubCount())
                .eqIfPresent(YfSipDeviceChannelDO::getParental, reqVO.getParental())
                .eqIfPresent(YfSipDeviceChannelDO::getHasAudio, reqVO.getHasAudio())
                .eqIfPresent(YfSipDeviceChannelDO::getDelFlag, reqVO.getDelFlag())
                .eqIfPresent(YfSipDeviceChannelDO::getCreateBy, reqVO.getCreateBy())
                .eqIfPresent(YfSipDeviceChannelDO::getUpdateBy, reqVO.getUpdateBy())
                .eqIfPresent(YfSipDeviceChannelDO::getRemark, reqVO.getRemark())
                .eqIfPresent(YfSipDeviceChannelDO::getDeviceSipId, reqVO.getDeviceSipId())
                .betweenIfPresent(YfSipDeviceChannelDO::getCreateTime, reqVO.getCreateTime())
                .isNotNull(YfSipDeviceChannelDO::getChannelName)
                .orderByDesc(YfSipDeviceChannelDO::getId));
    }

}
