package cn.iocoder.yudao.module.pms.dal.mysql.alarm;

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.alarm.vo.IotVideoAlarmPageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.alarm.IotVideoAlarmDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 资料 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface IotVideoAlarmMapper extends BaseMapperX<IotVideoAlarmDO> {

    default PageResult<IotVideoAlarmDO> selectPage(IotVideoAlarmPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotVideoAlarmDO>()
                .eqIfPresent(IotVideoAlarmDO::getIpAddress, reqVO.getIpAddress())
                .eqIfPresent(IotVideoAlarmDO::getPortNo, reqVO.getPortNo())
                .eqIfPresent(IotVideoAlarmDO::getProtocol, reqVO.getProtocol())
                .betweenIfPresent(IotVideoAlarmDO::getDateTime, reqVO.getDateTime())
                .eqIfPresent(IotVideoAlarmDO::getActivePostCount, reqVO.getActivePostCount())
                .eqIfPresent(IotVideoAlarmDO::getPresetNo, reqVO.getPresetNo())
                .eqIfPresent(IotVideoAlarmDO::getEventType, reqVO.getEventType())
                .eqIfPresent(IotVideoAlarmDO::getEventState, reqVO.getEventState())
                .eqIfPresent(IotVideoAlarmDO::getEventDescription, reqVO.getEventDescription())
                .eqIfPresent(IotVideoAlarmDO::getUrl, reqVO.getUrl())
                .likeIfPresent(IotVideoAlarmDO::getMpName, reqVO.getMpName())
                .eqIfPresent(IotVideoAlarmDO::getDeviceId, reqVO.getDeviceId())
                .eqIfPresent(IotVideoAlarmDO::getTaskId, reqVO.getTaskId())
                .eqIfPresent(IotVideoAlarmDO::getChannelId, reqVO.getChannelId())
                .likeIfPresent(IotVideoAlarmDO::getChannelName, reqVO.getChannelName())
                .eqIfPresent(IotVideoAlarmDO::getProtocolType, reqVO.getProtocolType())
                .eqIfPresent(IotVideoAlarmDO::getChildDevId, reqVO.getChildDevId())
                .betweenIfPresent(IotVideoAlarmDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IotVideoAlarmDO::getId));
    }

}