package cn.iocoder.yudao.module.device.dal.mysql.cameradevice;

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.device.dal.dataobject.cameradevice.CameraDeviceDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.device.controller.admin.cameradevice.vo.*;

/**
 * 设备-监控摄像头 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface CameraDeviceMapper extends BaseMapperX<CameraDeviceDO> {

    default PageResult<CameraDeviceDO> selectPage(CameraDevicePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CameraDeviceDO>()
                .eqIfPresent(CameraDeviceDO::getFactoryId, reqVO.getFactoryId())
                .likeIfPresent(CameraDeviceDO::getName, reqVO.getName())
                .eqIfPresent(CameraDeviceDO::getCode, reqVO.getCode())
                .eqIfPresent(CameraDeviceDO::getType, reqVO.getType())
                .eqIfPresent(CameraDeviceDO::getStatus, reqVO.getStatus())
                .eqIfPresent(CameraDeviceDO::getIconUrl, reqVO.getIconUrl())
                .eqIfPresent(CameraDeviceDO::getVideoUrl, reqVO.getVideoUrl())
                .eqIfPresent(CameraDeviceDO::getStreamUrl, reqVO.getStreamUrl())
                .eqIfPresent(CameraDeviceDO::getSort, reqVO.getSort())
                .eqIfPresent(CameraDeviceDO::getIsShow, reqVO.getIsShow())
                .betweenIfPresent(CameraDeviceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CameraDeviceDO::getId));
    }

}