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

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.pms.controller.admin.iotwebtopoprojectdevice.vo.IotWebtopoProjectDevicePageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotwebtopoprojectdevice.IotWebtopoProjectDeviceDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 组态项目关联设备 Mapper
 *
 * @author ruiqi
 */
@Mapper
public interface IotWebtopoProjectDeviceMapper extends BaseMapperX<IotWebtopoProjectDeviceDO> {

    default PageResult<IotWebtopoProjectDeviceDO> selectPage(IotWebtopoProjectDevicePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotWebtopoProjectDeviceDO>()
                .eqIfPresent(IotWebtopoProjectDeviceDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(IotWebtopoProjectDeviceDO::getProjectId, reqVO.getProjectId())
                .inIfPresent(IotWebtopoProjectDeviceDO::getProjectId, reqVO.getProjectIds())
                .eqIfPresent(IotWebtopoProjectDeviceDO::getDeviceId, reqVO.getDeviceId())
                .eqIfPresent(IotWebtopoProjectDeviceDO::getRemark, reqVO.getRemark())
                .eqIfPresent(IotWebtopoProjectDeviceDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(IotWebtopoProjectDeviceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IotWebtopoProjectDeviceDO::getId));
    }

}