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

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

/**
 * 设备关联表(如：瑞都主要设备) Mapper
 *
 * @author ruiqi
 */
@Mapper
public interface IotDeviceAssociateMapper extends BaseMapperX<IotDeviceAssociateDO> {

    default PageResult<IotDeviceAssociateDO> selectPage(IotDeviceAssociatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotDeviceAssociateDO>()
                .eqIfPresent(IotDeviceAssociateDO::getDeptId, reqVO.getDeptId())
                .inIfPresent(IotDeviceAssociateDO::getDeptId, reqVO.getDeptIds())
                .eqIfPresent(IotDeviceAssociateDO::getDeviceId, reqVO.getDeviceId())
                .eqIfPresent(IotDeviceAssociateDO::getType, reqVO.getType())
                .eqIfPresent(IotDeviceAssociateDO::getRemark, reqVO.getRemark())
                .eqIfPresent(IotDeviceAssociateDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(IotDeviceAssociateDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IotDeviceAssociateDO::getId));
    }

}